【问题标题】:Spring Boot & Elastic client - NoSuchMethodError: org.elasticsearch.action.support.IndicesOptions.ignoreThrottled()ZSpring Boot & Elastic 客户端 - NoSuchMethodError: org.elasticsearch.action.support.IndicesOptions.ignoreThrottled()Z
【发布时间】:2019-12-19 21:53:00
【问题描述】:

我们创建了一个带有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,但没有帮助

【问题讨论】:

    标签: java spring maven spring-boot elasticsearch


    【解决方案1】:

    关注this answer here,发现Elastic服务器有6.5.4版本。

    把依赖改成

    &lt;elasticsearch.version&gt;6.5.4&lt;/elasticsearch.version&gt;

    或者

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

    解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2015-08-26
      • 2022-11-28
      • 1970-01-01
      • 1970-01-01
      • 2019-06-29
      • 2016-09-28
      • 2018-08-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多