# Using Elastic Search Latest Version Throw Exception

**URL:** <https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [February 7, 2024, 10:58am UTC](https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739 "2024-02-07T10:58:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GANESHAN\_RAMAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ganeshan_raman/32/131511_2.png) [@GANESHAN\_RAMAN](https://discuss.elastic.co/u/GANESHAN_RAMAN)\
**Post date:** [February 7, 2024, 10:58am UTC](https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739/1 "2024-02-07T10:58:45Z")

</div>

Hi,  
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  
  
org.elasticsearch  
elasticsearch  
**8.12.0**  
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.

Thanks,  
Ganeshan

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [February 7, 2024, 11:17am UTC](https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739/2 "2024-02-07T11:17:23Z")

</div>

Hello,  
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](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/migrate-hlrc.html)  
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.

---

<div class="post-metadata">

**Author:** ![GANESHAN\_RAMAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ganeshan_raman/32/131511_2.png) [@GANESHAN\_RAMAN](https://discuss.elastic.co/u/GANESHAN_RAMAN)\
**Post date:** [February 7, 2024, 11:42am UTC](https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739/3 "2024-02-07T11:42:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GANESHAN\_RAMAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ganeshan_raman/32/131511_2.png) [@GANESHAN\_RAMAN](https://discuss.elastic.co/u/GANESHAN_RAMAN)\
**Post date:** [February 8, 2024, 1:54pm UTC](https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739/4 "2024-02-08T13:54:50Z")

</div>

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:**  
nativeSearchQueryBuilder.withQuery(boolQueryBuilder);

**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.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 7, 2024, 1:55pm UTC](https://discuss.elastic.co/t/using-elastic-search-latest-version-throw-exception/352739/5 "2024-03-07T13:55:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
