Hello guys,
I know there is a topic with the same issue but the answer doesn't solve my issue.
I got a really basic spring boot 2.2.0 app which is supposed to connect to a ES 7.2.0.
but when i try to search anything i got the error :
java.lang.NoSuchMethodError: org.elasticsearch.search.SearchHits.getTotalHits()J
at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.doCount(ElasticsearchRestTemplate.java:605) ~[spring-data-elasticsearch-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.count(ElasticsearchRestTemplate.java:566) ~[spring-data-elasticsearch-3.2.4.RELEASE.jar:3.2.4.RELEASE]
I can provide the full stack trace but there is a char limit and i think the dependency is more useful
I got my code here : https://github.com/SachaMaiornikoff/digger-back/tree/RestHighLevelClient_and_bonsai_impl
I already forced my ES version on my pom.xml with
<elasticsearch.version>7.2.0</elasticsearch.version>
and it's basically the only solution that i found on google.
here is the result of my mvn dependency:tree :
[INFO] com.smaiornikoff:back:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:2.2.0.RELEASE:compile
[INFO] +- org.elasticsearch:elasticsearch:jar:7.2.0:compile
[INFO] | +- org.elasticsearch:elasticsearch-core:jar:7.2.0:compile
[INFO] | +- org.elasticsearch:elasticsearch-secure-sm:jar:7.2.0:compile
[INFO] | +- org.elasticsearch:elasticsearch-x-content:jar:7.2.0:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.10.0:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.0:compile
[INFO] | | \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.10.0:compile
[INFO] | +- org.elasticsearch:elasticsearch-geo:jar:7.2.0:compile
[INFO] | +- org.apache.lucene:lucene-core:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-analyzers-common:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-backward-codecs:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-grouping:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-highlighter:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-join:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-memory:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-misc:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-queries:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-queryparser:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-sandbox:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial-extras:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-spatial3d:jar:8.0.0:compile
[INFO] | +- org.apache.lucene:lucene-suggest:jar:8.0.0:compile
[INFO] | +- org.elasticsearch:elasticsearch-cli:jar:7.2.0:compile
[INFO] | | \- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] | +- joda-time:joda-time:jar:2.10.5:compile
[INFO] | +- com.tdunning:t-digest:jar:3.2:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] | \- org.elasticsearch:jna:jar:4.5.1:compile
[INFO] +- org.elasticsearch.client:elasticsearch-rest-client:jar:7.2.0:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.10:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.12:compile
[INFO] | +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile
[INFO] | +- org.apache.httpcomponents:httpcore-nio:jar:4.4.12:compile
[INFO] | \- commons-codec:commons-codec:jar:1.13:compile
[INFO] +- org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:7.2.0:compile
[INFO] | +- org.elasticsearch.plugin:parent-join-client:jar:7.2.0:compile
[INFO] | +- org.elasticsearch.plugin:aggs-matrix-stats-client:jar:7.2.0:compile
[INFO] | +- org.elasticsearch.plugin:rank-eval-client:jar:7.2.0:compile
[INFO] | \- org.elasticsearch.plugin:lang-mustache-client:jar:7.2.0:compile
[INFO] | \- com.github.spullara.mustache.java:compiler:jar:0.9.3:compile
[INFO] +- org.springframework.data:spring-data-elasticsearch:jar:3.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:5.2.1.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.2.1.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:5.2.1.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:5.2.1.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:5.2.1.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:2.2.1.RELEASE:compile
[INFO] | +- org.elasticsearch.client:transport:jar:7.2.0:compile
[INFO] | | +- org.elasticsearch.plugin:reindex-client:jar:7.2.0:compile
[INFO] | | | \- org.elasticsearch:elasticsearch-ssl-config:jar:7.2.0:compile
[INFO] | | \- org.elasticsearch.plugin:percolator-client:jar:7.2.0:compile
[INFO] | +- org.elasticsearch.plugin:transport-netty4-client:jar:7.2.0:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.1.43.Final:compile
[INFO] | | +- io.netty:netty-codec:jar:4.1.43.Final:compile
[INFO] | | +- io.netty:netty-codec-http:jar:4.1.43.Final:compile
[INFO] | | +- io.netty:netty-common:jar:4.1.43.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.43.Final:compile
[INFO] | | +- io.netty:netty-resolver:jar:4.1.43.Final:compile
[INFO] | | \- io.netty:netty-transport:jar:4.1.43.Final:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.10.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.0:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.29:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.2.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.2.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.1.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.29:compile
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.springframework:spring-core:jar:5.2.1.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.2.1.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.25:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.2.0.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.2.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.2.1.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.5.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.5.2:test
[INFO] | | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | | \- org.junit.platform:junit-platform-commons:jar:1.5.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.5.2:test
[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.5.2:test
[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.5.2:test
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.1.0:test
[INFO] | +- org.assertj:assertj-core:jar:3.13.2:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.1:test
[INFO] | +- org.mockito:mockito-core:jar:3.1.0:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.10.2:compile
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.2:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.2.1.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.3:test
[INFO] +- org.projectlombok:lombok:jar:1.16.10:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.2.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.2.1.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.0:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.0:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.10.0:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.1.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.27:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.27:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.27:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:2.2.1.RELEASE:compile
[INFO] | | +- jakarta.validation:jakarta.validation-api:jar:2.0.1:compile
[INFO] | | \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.2.1.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.2.1.RELEASE:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.18:compile
[INFO] \- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.2.0.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:2.2.1.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.9.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.2.1.RELEASE:compile
[INFO] | +- com.zaxxer:HikariCP:jar:3.4.1:compile
[INFO] | \- org.springframework:spring-jdbc:jar:5.2.1.RELEASE:compile
[INFO] +- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.4.8.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.24.0-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
[INFO] | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.2:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.8:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8.1:compile
[INFO] | \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:2.2.1.RELEASE:compile
[INFO] | \- org.springframework:spring-orm:jar:5.2.1.RELEASE:compile
[INFO] \- org.springframework:spring-aspects:jar:5.2.1.RELEASE:compile
So i believe the dependencies are set just right.
I'm sure it's something really simple that i'm missing out but i'd be thankful if someone got any clue in which direction i should look.
Thanks,
Sacha