I'm new to Elastic search. Started building a Spring boot application with Elastic search.
Using the latest ES version "elasticsearch-7.7.1" and for integration, I'm using below maven dependency:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.7.1</version>
</dependency>
Added below configuration to my spring boot app:
@Configuration
public class ESConfig {
@Bean(destroyMethod = "close")
public RestHighLevelClient client() {
RestHighLevelClient restHighLevelClient = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost")));
return restHighLevelClient;
}
}
Added below properties to application.yaml
elasticsearch:
host: localhost
Getting below Exception on Application startup:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.RestHighLevelClient]: Factory method 'client' threw exception; nested exception is java.lang.NoSuchFieldError: IGNORE_DEPRECATIONS
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
... 19 common frames omitted
Caused by: java.lang.NoSuchFieldError: IGNORE_DEPRECATIONS
at org.elasticsearch.client.RestHighLevelClient.<clinit>(RestHighLevelClient.java:1902)
at com.sbs.communicationcontrol.search.config.ESConfig.client(ESConfig.java:14)
Can anyone please help why this exception occurred?