While performing reindex operation, I am setting the request timeout to be 60 mins as below
request.setTimeout(TimeValue. timeValueMinutes (60));
With the above config in place my request is still timing out for 30,000 ms. How can I avoid the below error
java.net.SocketTimeoutException: 30,000 milliseconds timeout on connection http-outgoing-0
After debugging enough, Came to know that socketTimeout should be set during client creation time and request timeout is something completely different from socketTimeout.
I started setting socketTimeout as below and worked fine.
return new RestHighLevelClient( RestClient.builder( HttpHost
.create( elasticSearchConfig().getEndPoint() ) )
.setHttpClientConfigCallback( hacb -> hacb.addInterceptorLast( interceptor ) )
.setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(elasticSearchConfig().getClientConnectionTimeout())
.setSocketTimeout(elasticSearchConfig().getClientSocketTimeout())));