RestHighLevelClient java client

#1

How can I use the RestHighLevelClient java client with Open Distro for Elasticsearch?

My code is:

final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(“admin”, “admin”));
RestClientBuilder restClientBuilder = RestClient.builder(httpHosts);
restClientBuilder.setHttpClientConfigCallback(httpClientBuilder ->
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
this.restClient = new RestHighLevelClient(restClientBuilder);

When I try to do a search I got the error:
“exception”: “javax.net.ssl.SSLHandshakeException”,
“message”: “General SSLEngine problem”

There are anyone that can give me an help?

Thank you

#2

Hi did u manage to figure this out?
I spent (wasted) 2 days and still couldn’t get either the Java RestHighLevelClient or the Java TCP Transport client working with the Security enabled (using demo ssl certs).

For now I was just able to get round the issue by using the elasticdump tool (security is still enabled):
elasticdump --input=“my data” --output=https://admin:admin@“my ip”:9200/“my index” --insecure --type=data