gpt4 book ai didi

java - Spring Boot 和 Elastic 客户端 - NoSuchMethodError : org. elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z

转载 作者:行者123 更新时间:2023-11-30 05:31:22 25 4
gpt4 key购买 nike

我们使用 ElasticSearch 7.3.0 客户端创建了一个 Spring Boot 2.1.7.RELEASE 应用。

当尝试运行 Elastic 客户端时,我们收到以下行错误:

SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);

Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z] with root cause 
java.lang.NoSuchMethodError: org.elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z
at org.elasticsearch.client.RequestConverters$Params.withIndicesOptions(RequestConverters.java:966)
at org.elasticsearch.client.RequestConverters.addSearchRequestParams(RequestConverters.java:417)
at org.elasticsearch.client.RequestConverters.search(RequestConverters.java:404)
at org.elasticsearch.client.RestHighLevelClient.lambda$search$2(RestHighLevelClient.java:932)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1450)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1424)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1394)
at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:930)

我们正在使用这些依赖项:

 <properties>
<spring-boot-version>2.1.7.RELEASE</spring-boot-version>
<elasticsearch.version>7.0.0</elasticsearch.version>
</properties>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>${spring-boot-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot-version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.3.0</version>
</dependency>

我们发现this post这导致我们添加了 elasticsearch.version 属性,但没有帮助。

我们还运行mvn dependency:tree -Dverbose来查看是否存在Elastic依赖项的联合,但似乎只有Elastic Client有Elastic相关的jar。

更新

已关注 this post我们尝试将 Elastic 客户端版本降级到 7.1.1 但没有帮助

最佳答案

已关注 this answer here ,我们发现Elastic服务器版本为6.5.4。

将依赖项更改为

<elasticsearch.version>6.5.4</elasticsearch.version>

或者

    <dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>

解决了问题。

关于java - Spring Boot 和 Elastic 客户端 - NoSuchMethodError : org. elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57476073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com