When upgrading from Elasticsearch 8 to 9, do I need to update my application server Java code? I use the ES 8 Java API to talk to an ES 8 (and 9?) server.
Is there any ES Java client version 9, for talking with ES server version 9? With some (breaking?) API changes? Or can I just continue using the ES 8 client, no changes required, except for upgrading to an ES 9 server? (With "client" here being my application server.)
There will be, but it might follow some time after the server release. However ...
... certainly as an interim measure this is what we expect folks to do. Elasticsearch has a REST compatibility mode which keeps the 8.x response format even in 9.x clusters to keep clients working across the upgrade.
AIUI the Java client adds these headers automatically, you don't need to take any action to enable this compatibility mode when working with a v9 cluster.
Just want to make sure I'm clear.
I can still use REST api in compatibility mode when running ES9.x, right?
I could just use latest REST client 8.18.x java code on ES 9.x in compatibility mode.
I just realized that "elasticsearch-rest-high-level-client" is only supported to 7.17.28.
Does this mean that I should use that version on ES version 9?
No, I wouldn't expect a 7.x client to work well against a 9.x cluster. The compatibility mode only gives one major version of leeway. You need to upgrade your client to an 8.x version (as you suggested in your previous message) before upgrading the cluster to 9.x.
But rest-high-level-client maven doesn't support 8.x though.
That's my question/confusion.
Are these 2 repo sort of equivalent?
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>8.x.x</version>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.17.28</version> <--- 7.17.28 is the latest supported version
I attempted to just switch to the new package "elasticsearch-rest-client" but got bunch of errors (lots of changes between the 2); therefore, I assume it's not meant for what I was doing.
Right yes the elasticsearch-rest-high-level-client was deprecated in 7.x and is no longer maintained. It's replaced with the newer elasticsearch-rest-client library in newer versions, to which you need to migrate. It is not a simple drop-in replacement library, you will need to update the calling code.
Wait, sorry, correction: I'm not sure what elasticsearch-rest-client is but I don't think you should be using that. I meant co.elastic.clients:elasticsearch-java, see e.g. Maven.
We are already using 1 major release older rest high client on 8.10.2 database.
We have not been able to migrate all the code to the java-api client yet (mainly due to the lack of example code we can find, so the transition is painfully slow. There are many threads regarding documentations. I won't elaborate here).
Is it possible to continue to use REST calls in our java code on new ES 9.x?
If yes, what maven version would be recommended?
(*note: I would/should not expect much code changes since it'll still be the standard REST. So if I see lots of compilation errors when switching to the new maven, I suspect something's not right, etc.)
Hope this clarifies my question more.
Thanks.
This maven is what I was referring to in my previous post:
Some APIs haven't changed between 7.x and 9.x so those will work with older clients. But others won't. So yes kinda partly possible but definitely not advisable.
The only path I can recommend is to finish this migration before you start to think about upgrading to ES 9.x. There is no massive rush to adopt 9.x yet, the 8.x series will continue to be maintained until January 2027. On the other hand the 7.x client is now unmaintained so will see no more bug fixes or security updates, so it's rather urgent to stop using it ASAP.
Probably 8.10.2 since that's the server version you're using. The Java client is quite broadly compatible, both forwards and backwards, so it doesn't matter hugely, but you may as well match versions for now until the migration is complete.
Yes that's unfortunately true. That's why we left more than 3 years in between announcing that the high-level client is deprecated (in 7.16.0, so 2021-12-07) and the end of its supported life (2025-05-25).
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.