java Elastic Search Lucene 版本错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27309354/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Elastic Search Lucene version error
提问by Vineel
I have a very simple ES Client which will send a query to local ES server(1.4.1 version of ES) and get the results and display to the user. Now, I took this code to a different project X and tried to use it along with X because I need some APIs from X. Now, when I run the same code when i am in X, then I get this error and don't know how to resolve. Can you please help me with this. Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_3_6
我有一个非常简单的 ES 客户端,它将向本地 ES 服务器(ES 的 1.4.1 版本)发送查询并获取结果并显示给用户。现在,我将此代码带到另一个项目 X 并尝试将它与 X 一起使用,因为我需要来自 X 的一些 API。知道怎么解决。你能帮我解决这个问题吗?线程“main”中的异常 java.lang.NoSuchFieldError: LUCENE_3_6
at org.elasticsearch.Version.<clinit>(Version.java:45)
at org.elasticsearch.node.internal.InternalNode.<init>(InternalNode.java:136)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:159)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)
at org.bmi.elasticsearch.ranking.TestClass2.main(TestClass2.java:54)
回答by eliasah
It seems that you are trying to use Elasticsearch and Lucene in your project as separate libraries.
看来您正试图在您的项目中将 Elasticsearch 和 Lucene 作为单独的库使用。
Elastissearch 1.4.1 is based on Lucene 4.10.2. You can check the release blog page herefor more details.
Elastissearch 1.4.1 基于 Lucene 4.10.2。您可以在此处查看发布博客页面以获取更多详细信息。
To solve your problem you will need to update your Lucene library version to 4.10 and use Version.LUCENE_CURRENT instead of LUCENE_3_6.
要解决您的问题,您需要将 Lucene 库版本更新到 4.10 并使用 Version.LUCENE_CURRENT 而不是 LUCENE_3_6。
You can find hereLucene 4.10 Core API documentation.
您可以在此处找到Lucene 4.10 Core API 文档。
I hope that this will help. Don't hesitate to comment if you have doubts.
我希望这会有所帮助。如果您有疑问,请不要犹豫发表评论。
回答by Dimitar II
Same error can occur in another case also - if someone unpack new ElasticSearch version in the same directory as previous version. Then it ends up with two versions of the jars in 'ElasticSearch/lib' directory. The error appears on startup.
在另一种情况下也可能发生相同的错误 - 如果有人在与以前版本相同的目录中解压新的 ElasticSearch 版本。然后它最终在 'ElasticSearch/lib' directory 中有两个版本的 jars。启动时出现错误。
In this case, the fix is to make clean ElasticSearch installation, without leftovers.
在这种情况下,修复方法是进行干净的 ElasticSearch 安装,没有剩余。