Hi All,
I have replaced org.elasticsearch.client.RestHighLevelClient to co.elastic.clients.elasticsearch.ElasticsearchClient . But, when mvn clean verify command is executed, the following exception is being thrown :
[ERROR] Failures:
[ERROR]AbstractTestNGSpringContextTests.run:154->testHighLevelClient» ExceptionInInitializer
[ERROR] RepositoryTest.destroy:393 » NoClassDefFound Could not initialize clas s org.elasticsearch.client.RestClientBuilder
[ERROR] RepositoryTest.init:66->createIndex:359 » NoClassDefFound Could not in itialize class org.elasticsearch.client.RestClientBuilder
Below dependencies have been added to the pom.xml:
co.elastic.clients elasticsearch-java 7.17.20 org.elasticsearch.client elasticsearch-rest-client 7.17.20 org.elasticsearch elasticsearch 7.17.20Below method is throwing the exception
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
import co.elastic.clients.transport.rest_client.RestClientTransport;
public ElasticsearchClient newEs7HighLevelClient() {
org.elasticsearch.client.RestClient restClient= org.elasticsearch.client .RestClient.builder(new HttpHost("localhost",9200,"http")).build();
RestClientTransport transport= new RestClientTransport(restClient,new Ja cksonJsonpMapper()) ;
ElasticsearchClient esClient= new ElasticsearchClient(transport);
return esClient;
}
Could anyone suggest some solution to resolve this issue.