keep the existing code as-is and use the new Java API Client for new features in your application, then later migrate the existing code,
How can I do that since HLRC support was totally removed in ES8+ ?
Should I use jars files from the 7.17.1 for HLRC and jar files from ES8+ for Java API ?
My app should have both jar files from both versions at the same time ?
Are packages totally separated so that everything can cohabitate smoothly ?
Could you provide some more practical explanations on this point ?
Thanks for the report, indeed this doc needs to be clarified and expanded.
I understand your server is in version 8.x.
You can use HLRC version 7.17.1 alongside the Java API client 8.x, with both using the same RestClient for http communication.
An important point though is that you have to enable the "compatibility mode" on HRLC: it will then send additional HTTP headers that inform ES8 to use a 7.x compatible mode to parse requests and send responses:
RestHighLevelClient = new RestHighLevelClientBuilder(restClient)
.setApiCompatibilityMode(true)
.build();
I could not find the .setApiCompatibilityMode(true) anywhere
Trying to index , I get : Unable to parse response body for Response{requestLine=POST /_bulk?timeout=1m HTTP/1.1, host=http://localhost:9200, response=HTTP/1.1 200 OK}
If I use a client with 8.1.0 jars
The Maven dependencies provides me 2 elastic jars
There is no way I can compile my HLRC client since eveything vanished
I do not get where the compatibility is and what the "smooth transition" could be
Can you provide some more explanations ?
You can use the Java API client version 8.x alongside HLRC version 7.17 (with compatibility mode enabled) with a 8.x Elasticsearch cluster.
Note: there are some HLRC versions 8.0.0-alpha on Maven Central, these should be ignored. However we keep releasing patch versions with bug fixes in the 7.17 branch. Version 7.17.2 was released a few days ago.
What about other versions of HLRC? Can Elasticsearch 8 cluster be made compatible with those? I am facing issue while writing the index when using HLRC 7.15.
I was able to make changes and update it to versions to following:
HighlevelRestClient : 7.17.2
Elasticsearch cluster 8.0.1
I have set the compatibility to true. I get the following error now:
java.lang.NoSuchMethodError: org.elasticsearch.client.RequestOptions$Builder.getHeaders()Ljava/util/List;
at org.elasticsearch.client.RestHighLevelClient.addCompatibilityFor(RestHighLevelClient.java:2632)
at org.elasticsearch.client.RestHighLevelClient.modifyRequestForCompatibility(RestHighLevelClient.java:2673)
at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2687)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:2171)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:2137)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:2105)
at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:1367)
at org.elasticsearch.client.KotlinExtensionsKt.search(KotlinExtensions.kt:212)
Do I need to headers separately? I changed my connector code to following using HLRC.
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.