Using Elastic Search Latest Version Throw Exception

My application with Elasticsearch was working fine until Elasticsearch version 7.17.9, As there is a vulnerability issue with this version as reported by black duck i changed to the recent version 8.12.0,
Once i changed this dependency as shown below iam getting exception "Unsatisfied dependency expressed through field 'restHighLevelClient': Error creating bean with name 'client' defined in com...****.setup.Application: Failed to instantiate [org.elasticsearch.client.RestHighLevelClient]: Factory method 'client' threw exception with message: org/elasticsearch/action/admin/indices/flush/SyncedFlushRequest"
during server start up

Just changing this dependency with no other code changes is breaking the application with the above exception, THis exception is triggred during server start up

Any idea why this exception triggers with the latest version of Elasticsearch.


I'm assuming this is about Java, please correct me if I'm wrong.
Please follow this guide:
Migrating from the High Level Rest Client | Elasticsearch Java API Client [8.12] | Elastic
which explains how to migrate from version 7 to 8. We advise using the new Java Rest API Client, since the old Rest High Level Client has been deprecated.

Thanks for your prompt response,
Yes this is related to java.
Will check the link and let you know in case of any issues.

After migrating to 8.x and replacing HLRC with ElasticClient application start up issue is resolved and iam forced to replace NativeSearchQueryBuilder to NativeQueryBuilder but iam not able to use withQuery in NativeQueryBuilder as shown below
Before Migrating:

After Migrating
nativeQueryBuilder.withQuery(boolQueryBuilder) doesnt compile as there is no withQuery API in NativeQueryBuilder
Can you please let me know what is the API to use boolQueryBuilder with NativeQueryBuilder.