# ElasticSearch HighLevel Rest client returns java.net.SocketTimeoutException

**URL:** <https://discuss.elastic.co/t/elasticsearch-highlevel-rest-client-returns-java-net-sockettimeoutexception/315537>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 30, 2022, 9:28am UTC](https://discuss.elastic.co/t/elasticsearch-highlevel-rest-client-returns-java-net-sockettimeoutexception/315537 "2022-09-30T09:28:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilBepi](https://avatars.discourse-cdn.com/v4/letter/i/67e7ee/32.png) [@ilBepi](https://discuss.elastic.co/u/ilBepi)\
**Post date:** [September 30, 2022, 9:28am UTC](https://discuss.elastic.co/t/elasticsearch-highlevel-rest-client-returns-java-net-sockettimeoutexception/315537/1 "2022-09-30T09:28:41Z")

</div>

Hello,  
I am updating Elasticsearch from version 7.4 to 7.17.  
My code instantiates an ElasticSearchNode, starts it, and then creates a HighLevel Rest client to make calls to that node.  
The node is local to the machine, and the address to which the client points is localhost with a certain port.  
When I try to make a putTemplate call with the client, I get the following exception:

```auto
java.net.SocketTimeoutException: 120,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE]
        at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:917) ~[elasticsearch-rest-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.RestClient.performRequest(RestClient.java:300) ~[elasticsearch-rest-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.RestClient.performRequest(RestClient.java:288) ~[elasticsearch-rest-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2699) ~[elasticsearch-rest-high-level-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:2171) ~[elasticsearch-rest-high-level-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:2137) ~[elasticsearch-rest-high-level-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:2105) ~[elasticsearch-rest-high-level-client-7.17.6.jar:7.17.6]
        at org.elasticsearch.client.IndicesClient.putTemplate(IndicesClient.java:1867) ~[elasticsearch-rest-high-level-client-7.17.6.jar:7.17.6]

```

I have already tried to add connectionRequestTimeout as someone suggested but without success:

```auto
            restClientBuilder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
                @Override
                public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {
                    return requestConfigBuilder.setConnectTimeout((int) timeout)
                            .setSocketTimeout((int) timeout)
                            .setConnectionRequestTimeout((int) timeout);
                }
            }); 

```

I would like to point out that, with version 7.4, everything works perfectly, so it is not a matter of ports already in use, or network connections.

If anyone could give me some help, it would be really appreciated.

Thanks very much

Giuseppe

---

<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:** [October 28, 2022, 9:29am UTC](https://discuss.elastic.co/t/elasticsearch-highlevel-rest-client-returns-java-net-sockettimeoutexception/315537/2 "2022-10-28T09:29:35Z")

</div>

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