We are using Elastic stack version 8.9 currently and Java api client 7.17. we want to upgrade to 9.x. From 8.9 we are migrating to 8.18 or 8.19, then from 8.19 version to 9.x. How should we upgrade java client?
Have you looked at the official documentation?
The Java 7.17 client should work with all 8.x versions as long as it is in compatibility mode, but is not guaranteed to work with Elasticsearch 9.x. I would therefore recommend following the flow in the official documentation and upgrade to Elasticsearch 8.19 before upgrading the client to the latest 8.x version as well. Once that is done you should be able to migrate to Elasticsearch 9.x as the 8.x client will work with this in compatibility mode.
Thanks for your quick response Christian. But I see that HLRC was deprecated in 7.15 and frozen on 7.17. So, Should we upgrade server to 8.19 first and migrate java HLRC 7.17 to java API client 8.x and then upgrade server to 9.x?
Yes, you will need to switch to the new Java client before going to Elasticsearch 9.x.
Note that there are 7.17 versions of the Java API client too, e.g. https://mvnrepository.com/artifact/co.elastic.clients/elasticsearch-java/7.17.29. So another option would be to migrate your application to this client while everything is still running in 7.17, from which point the upgrades to 8.x and 9.x will be more straightforward.
Whatever you do you need to do it reasonably soon: 7.17 reaches the end of its support term on 2026-01-15.
Should we Refactor the code to Java API client first (to 7.17 or 8.x) or do the server upgrade first to 8.19.x? And is Java runtime 21 compatible with above versions?
It’s your choice. Either is ok.
I believe so.
How to plan this migration in production?
Everything discussed above applies to a production deployment.