I have copied exactly the same steps as the documentation elastic8 docs
@Bean
public ElasticsearchClient getElasticSearchClient(){
RestClient restClient = RestClient.builder(
new HttpHost("", 9200)).build();
// Create the transport with a Jackson mapper
ElasticsearchTransport transport = new RestClientTransport(
restClient, new JacksonJsonpMapper());
// And create the API client
ElasticsearchClient client = new ElasticsearchClient(transport);
return client;
}
and I'm receiving this error
Error it gives
An attempt was made to call a method that does not exist. The attempt was made from the following location:
co.elastic.clients.transport.rest_client.RestClientOptions.addBuiltinHeaders(RestClientOptions.java:170)
The following method did not exist:
'org.elasticsearch.client.RequestOptions$Builder org.elasticsearch.client.RequestOptions$Builder.removeHeader(java.lang.String)'
The method's class, org.elasticsearch.client.RequestOptions$Builder, is available from the following locations:
Saw the library of rest_client that was causing the issue and it's 7.2.
my pom is the following
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.