2

I have been stuck with this issue for a while now and any assistance is appreciated. I am running Spring Boot version 2.2.0 with the ElasticSearch high-level REST Client version 6.4.3 and using version 3.2.0 for the Spring-Data-Elasticsearch version. I am getting the error below. I have tried the following attempts to fix but none do.

  1. Change Spring Boot Version multiple times
  2. Change ES version multiple times
  3. I have cleared my .m2 folder and redownloaded the maven dependencies multiple times.

The issue I am getting below is

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.putMapping(ElasticsearchRestTemplate.java:292)

The following method did not exist:

org.elasticsearch.client.IndicesClient.putMapping(Lorg/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest;Lorg/elasticsearch/client/RequestOptions;)Lorg/elasticsearch/action/support/master/AcknowledgedResponse;

The method's class, org.elasticsearch.client.IndicesClient, is available from the following locations:

jar:file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/6.4.3/elasticsearch-rest-high-level-client-6.4.3.jar!/org/elasticsearch/client/IndicesClient.class

It was loaded from the following location: file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/6.4.3/elasticsearch-rest-high-level-client-6.4.3.jar

Action: Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.IndicesClient

My POM is below

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-elasticsearch</artifactId>
        <version>3.2.0</version>
    </dependency>

Any help is appreciated. I am sure it has to deal with compatibility issues but not sure which. Thanks all!

Update

I was able to get it run sucessfully by changing my elasticsearch version to 6.7.0. But now I am receiving the following error

org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=index_not_found_exception, reason=no such index]

My POM looks like this below now also.

    <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>6.70</version>
        </dependency>

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

    <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-client</artifactId>
        <version>6.70</version>
    </dependency>
Mohamed Ali
  • 702
  • 8
  • 29
  • which elasticsearch version you are using, you can get it from curl localhost:9200, on the elasticsearch server. –  Jun 01 '20 at 01:37
  • check update please @PrernaGupta – Mohamed Ali Jun 01 '20 at 04:18
  • Glad you were able to now run the code and this exception is different, I would write a answer for previous issue and would advise to ask a followup question with relevant details(code which is causing the `index_not_found_exception ` ) and would be more than happy to help you with this required information. –  Jun 01 '20 at 04:35
  • should I open up another question @PrernaGupta for the new error I am getting? – Mohamed Ali Jun 01 '20 at 04:39
  • Yeah please and ping me the question link –  Jun 01 '20 at 04:59

2 Answers2

2

Previous issue of method that does not exist. was resolved by changing the elasticsearch version to 6.7.0.

To avoid these incompatibility issues its always recommend to use the same version of elasticsearch server and its client.

0

I faced the exact same issue, I was using elastic search 6.8.18. and as mentioned changed the version of elastic search by using below in Gradle.

ext['elasticsearch.version'] = '6.8.18'

use this for reference - overriding dependency versions