# When to open/close java RestHighLevelClient

**URL:** <https://discuss.elastic.co/t/when-to-open-close-java-resthighlevelclient/219265>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [February 13, 2020, 5:39pm UTC](https://discuss.elastic.co/t/when-to-open-close-java-resthighlevelclient/219265 "2020-02-13T17:39:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViniFKroth](https://avatars.discourse-cdn.com/v4/letter/v/e68b1a/32.png) [@ViniFKroth](https://discuss.elastic.co/u/ViniFKroth)\
**Post date:** [February 13, 2020, 5:39pm UTC](https://discuss.elastic.co/t/when-to-open-close-java-resthighlevelclient/219265/1 "2020-02-13T17:39:14Z")

</div>

Searching the web, I found little to no regarding the the scope of Java's RestHighLevelClient, like tradeoffs on using it application scoped or request scope? I understand that RestLowLevelClient manages a thread pool and the nodes connections, which can impact in the app performance, but assuming i'm having a high income of requests that use the ES, what you guys thing it's the best approach?

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [February 13, 2020, 9:22pm UTC](https://discuss.elastic.co/t/when-to-open-close-java-resthighlevelclient/219265/2 "2020-02-13T21:22:00Z")

</div>

Just use high rest client. that's the trend moving forward.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [February 13, 2020, 9:49pm UTC](https://discuss.elastic.co/t/when-to-open-close-java-resthighlevelclient/219265/3 "2020-02-13T21:49:07Z")

</div>

The high-level REST client is a wrapper around the low-level REST client, and as such it should have a similar lifecycle. You should keep them around for a long time and re-use them as much as possible.

---

<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 12, 2020, 9:49pm UTC](https://discuss.elastic.co/t/when-to-open-close-java-resthighlevelclient/219265/4 "2020-03-12T21:49:09Z")

</div>

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