ElasticSearch HighLevel Rest client returns java.net.SocketTimeoutException

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:

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:

            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

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