# Socks proxy support for Elasticsearch java client

**URL:** <https://discuss.elastic.co/t/socks-proxy-support-for-elasticsearch-java-client/371352>\
**Category:** Elasticsearch\
**Created:** [December 3, 2024, 2:37am UTC](https://discuss.elastic.co/t/socks-proxy-support-for-elasticsearch-java-client/371352 "2024-12-03T02:37:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramazangirgin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramazangirgin/32/139642_2.png) [@ramazangirgin](https://discuss.elastic.co/u/ramazangirgin)\
**Post date:** [December 3, 2024, 2:37am UTC](https://discuss.elastic.co/t/socks-proxy-support-for-elasticsearch-java-client/371352/1 "2024-12-03T02:37:13Z")

</div>

Socks proxy support for Elasticsearch java client

* * *

Hi,  
We are using elasticsearch java client and we need to configure SOCKS proxy for our application. Unfortunately http proxy is not an option for us.

I see some posts sent earlier but there was no clear, helpful answer.

As also described in [How to set a socks5 proxy for ElasticsearchTemplate (Java Client)](https://discuss.elastic.co/t/how-to-set-a-socks5-proxy-for-elasticsearchtemplate-java-client/126796) as well, HttpAsyncClient v4 doesn't have support for SOCKS proxy.  
please also see another related topic in;  
[Can the java High Level REST client use a socks5 proxy?](https://discuss.elastic.co/t/can-the-java-high-level-rest-client-use-a-socks5-proxy/356910)

I checked the options for integrating it with `HttpAsyncClientBuilder#setConnectionManager` but i couldn't find any working example, solution for it.  
Elasticsearch java client uses HttpAsyncClient version which is not maintained anymore. Please also see [elasticsearch-rest-client is using an old non-maintained version of httpasyncclient-4.1.4.jar · Issue #66136 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/66136).

new version is v5 and has socks proxy support.

> <https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/async/HttpAsyncClient.java>

Since i am not expert on HttpAsyncClient and Elasticsearch client, can you please give guide me to have SOCKS support somehow ?  
Checked the [https://lists.apache.org/thread/2jnhlt0h6td838hyyb6ydnxc86lrgsrx](https://lists.apache.org/thread/2jnhlt0h6td838hyyb6ydnxc86lrgsrx) as well, but since ES client uses PoolingNHttpClientConnectionManager, it is not possible to easily set socket proxy for it.

Do you have some samples, suggestion guideline for integrating the connection manager by using `org.apache.http.impl.nio.client.HttpAsyncClientBuilder#setConnectionManager` ?

Thanks in advance  
Ramazan
