Hello, I'm trying to use the high level API like this:
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials("user", "pass"));
RestClientBuilder builder = RestClient.builder(
new HttpHost("host1", 9200, "http"),
new HttpHost("host2", 9200, "http")
)
.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
});
RestHighLevelClient esClient = new RestHighLevelClient(builder);
SearchRequest searchRequest = new SearchRequest("my_index");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchAllQuery());
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = esClient.search(searchRequest);
And getting error:
Handler dispatch failed; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError: org.elasticsearch.action.search.SearchResponse.fromXContent(Lorg/elasticsearch/common/xcontent/XContentParser;)Lorg/elasticsearch/action/search/SearchResponse;
I have dependencies in maven:
`<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.3.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.3.2</version>
</dependency>`
What can be wrong?
P.S. The old (low level) API works well for me