# How to configure the client in opensearch-java client library?

**URL:** <https://forum.opensearch.org/t/how-to-configure-the-client-in-opensearch-java-client-library/23713>\
**Category:** OpenSearch Client Libraries\
**Tags:** opensearch-java\
**Created:** [March 10, 2025, 9:25am UTC](https://forum.opensearch.org/t/how-to-configure-the-client-in-opensearch-java-client-library/23713 "2025-03-10T09:25:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sorrow](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sorrow](https://forum.opensearch.org/u/sorrow)\
**Post date:** [March 10, 2025, 9:25am UTC](https://forum.opensearch.org/t/how-to-configure-the-client-in-opensearch-java-client-library/23713/1 "2025-03-10T09:25:28Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):

AWS OpenSearch 2.17

**Describe the issue** :

I am trying to connect to an AWS Opensearch 2.17 from my ECS.  
I was using the Elasticsearch 6.6.0 client library previously where I was using an interceptor and setHttpClientConfigCallback to set the following configurations in the RestClient: setMaxConnTotal, setIoThreadCount, setMaxRetryTimeoutMillis

I haven’t been able to migrate this setup into the OpenSearch java client library since the high-level rest client seems deprecated. This is the setup I require.

```auto
new RestHighLevelClient(RestClient
        .builder(HttpHost.create("my_os_url")
        .setHttpClientConfigCallback(hacb -> hacb.addInterceptorLast(interceptor).setMaxConnTotal(1)
            .setDefaultIOReactorConfig(IOReactorConfig.custom().setIoThreadCount(500).build()))
        .setMaxRetryTimeoutMillis(60 * 1000));

```

Can someone help me set this up in the opensearch-java library?

---

<div class="post-metadata">

**Author:** ![sorrow](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sorrow](https://forum.opensearch.org/u/sorrow)\
**Post date:** [March 13, 2025, 7:25am UTC](https://forum.opensearch.org/t/how-to-configure-the-client-in-opensearch-java-client-library/23713/2 "2025-03-13T07:25:52Z")

</div>

I have tried using the apachev5 interceptor as well similar to what’s mentioned [https://forum.opensearch.org/t/signing-request-with-apache-httpclient-5-transport/18333](https://here) but I faced the same issue

---

<div class="post-metadata">

**Author:** ![reta](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@reta](https://forum.opensearch.org/u/reta)\
**Post date:** [March 14, 2025, 7:37pm UTC](https://forum.opensearch.org/t/how-to-configure-the-client-in-opensearch-java-client-library/23713/3 "2025-03-14T19:37:09Z")

</div>

Please check [1], there is a dedicated AWS transport to connect to AWS managed services, thank you

[1] [opensearch-java/guides/auth.md at main · opensearch-project/opensearch-java · GitHub](https://github.com/opensearch-project/opensearch-java/blob/main/guides/auth.md?plain=1)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [May 13, 2025, 7:37pm UTC](https://forum.opensearch.org/t/how-to-configure-the-client-in-opensearch-java-client-library/23713/4 "2025-05-13T19:37:44Z")

</div>

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