I'm migrating XWiki to use the new Java API client with ES 8.2.0 and I can't find a way to tell the API to connect to a URL (https://domainname/path).
If I use RestClient restClient = RestClient.builder(HttpHost.create(pingURL)) then I get a UnknownHostException: domainname/path: nodename nor servname provided, or not known.
I cannot use RestClient.builder(new HttpHost(...)) since that doesn't allow to pass a path.
FWIW, I was previously using the following with ES 1.1:
HttpClientConfig clientConfig = new HttpClientConfig.Builder("https://domainname/path").multiThreaded(true).build();
JestClientFactory factory = new XWikiJestClientFactory(this.configuration);
factory.setHttpClientConfig(clientConfig);
JestClient client = factory.getObject();
I'm glad you found the answer! When it comes to connecting to the Elasticsearch cluster, there is no difference between the old High Level Rest Client and the Java API client since they both use the low level RestClient. And you can actually use that low level client directly to more easily debug connection/network related issues.
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.