We are using Elasticsearch 7.17.5 which is used by a Java 8 application. We are planning to upgrade to Elasticsearch 8.x.
Since High-level Rest Client is now deprecated I am unable to resolve dependencies in order to use the HLRC existing code with Elasticsearch Version 8.x.( High Level Client compatibilty with ES 8 )
Which version of elasticsearch-rest-high-level-client should we use?
Also do we need to migrate our java application to java 17?
Generally, you should start looking at the new Java API Client. Though it doesn't need to be immediately and you can also do a piece by piece migration if that makes it easier (see https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/migrate-hlrc.html).
For your specific problem:
What's the dependency you cannot resolve? Because the old HLRC should be able to work with 8.x — quote from the documentation link you've posted:
And the new Java API Client also supports JDK 8 or newer, see https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/installation.html.