请告诉我我做错了什么?
我使用了以下依赖项:
<dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>${elasticsearch.version}</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> <version>${elasticsearch.version}</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client-sniffer</artifactId> <version>${elasticsearch.version}</version> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>${elasticsearch.version}</version> </dependency>
具有Lucene依赖关系的7.10.1版的所有版本:
<dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-core</artifactId> <scope>runtime</scope> <version>8.7.0</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-analyzers-common</artifactId> <scope>runtime</scope> <version>8.7.0</version> </dependency>
但我得到以下错误:
java: cannot access org.apache.lucene.search.TotalHits class file for org.apache.lucene.search.TotalHits not found.
当我跑的时候
searchResponse.getHits().getTotalHits().value
发布于 2021-05-13 17:08:51
<dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>7.11.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-client --> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> <version>7.11.1</version> </dependency>