NoClassDefFoundError error creating RestHighLevelClient bean

You probably need the core dependency as well:

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

A NoClassDefFoundError is generally a configuration error - it means that the code you use references a certain class, but the class itself isn't in the classpath. In this case, this might also be a dependency management error in the relevant Elasticsearch poms themselves, as they should include the needed classes - but there's not much you can do about that other than perhaps file an issue.


I had the same problem. ElasticSearch pointed to old version:

org.elasticsearch:elasticsearch:6.2.3 -> 1.5.2

I used dependencyManagement gradle plugin to force use the version I mention:

dependencyManagement {
dependencies {
    dependency 'org.elasticsearch:elasticsearch:6.2.3'
}}

For more info: https://github.com/spring-gradle-plugins/dependency-management-plugin