这就是我的构造方式:
SearchRequest searchRequest = new SearchRequest();
IntelliJ添加了所有导入,并且我在pom.xml中添加了依赖项:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>6.4.0</version>
</dependency>
我的弹性搜索版本也与客户端匹配:
{
"name" : "hQanR4j",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "50rqwF7hTbCPsBWgzEydpw",
"version" : {
"number" : "6.4.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "595516e",
"build_date" : "2018-08-17T23:18:47.308994Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
将断点放在创建SearchRequest对象的行上时,我看到此错误:“无法初始化类org.elasticsearch.action.search.SearchRequest”
如果我没有断点,则会出现此错误:“ LUCENE_6_0_0”
我试图将其包含在try..catch中以打印异常信息,但没有被捕获。我想我还没有为SearchRequest添加正确的依赖项。
它不是Elastic Search Lucene version error
的副本我已经清除了elasticsearch,然后删除了/ var / lib / elasticsearch /目录,然后再次安装了它,问题仍然存在。