Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
134 views
in Technique[技术] by (71.8m points)

java - Elastic Search Lucene version error

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

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)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems that you are trying to use Elasticsearch and Lucene in your project as separate libraries.

Elastissearch 1.4.1 is based on Lucene 4.10.2. You can check the release blog page here for more details.

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.

You can find here Lucene 4.10 Core API documentation.

I hope that this will help. Don't hesitate to comment if you have doubts.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...