0

I use elastic search 6.3.2 java client with spring boot, and the error is Request class is missing.

However from the dependencies, I could clearly find the request class. Any idea how to solve this problem? Only add one dependency of elastic search

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

the dependencies

java.lang.NoSuchMethodError: org.elasticsearch.client.Request.<init>(Ljava/lang/String;Ljava/lang/String;)V
    at org.elasticsearch.client.RestClient.performRequest(RestClient.java:317) ~[elasticsearch-rest-client-6.4.3.jar:6.4.3]
    at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:522) ~[elasticsearch-rest-high-level-client-6.3.2.jar:6.4.3]
    at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:508) ~[elasticsearch-rest-high-level-client-6.3.2.jar:6.4.3]
    at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:99) ~[elasticsearch-rest-high-level-client-6.3.2.jar:6.4.3]
    at hello.HelloController.createIndex(HelloController.java:61) ~[classes/:na]
    at hello.HelloController.index(HelloController.java:39) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
Bargitta
  • 2,266
  • 4
  • 22
  • 35
  • What does your dependency tree look like? You might have 2 different versions of the elastic client on your classpath. – pandaadb May 31 '19 at 10:23
  • @pandaadb i add the dependency tree , will u pls take a look? – Bargitta May 31 '19 at 10:27
  • It does seem like you may have 2 versions (6.3.2 and 6.4.3) which may be sharing some dependencies which could cause this behaviour. This I also think isn't the complete tree. You can try and have the same version for your core elasticsearch and the clients. In particular it strikes me as odd that one client is on 6.4.3 and one on 6.3.2. – pandaadb May 31 '19 at 10:30
  • thanks, I'll check it. It's weird, I simply add one dependency in maven, and it automatically downloads these things – Bargitta May 31 '19 at 10:34

0 Answers0