Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

elasticsearch error:DataAccessResourceFailureException: 30,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE];

org.springframework.dao.DataAccessResourceFailureException: 30,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE]; nested exception is java.lang.RuntimeException: 30,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE] Caused by: java.lang.RuntimeException: 30,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE] at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.translateException(ElasticsearchRestTemplate.java:425) ... 108 more Caused by: java.net.SocketTimeoutException: 30,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE]

like image 622
yexu Avatar asked Oct 30 '25 07:10

yexu


1 Answers

Your configuration is using the default timeout. Configure your RestClient as follows:

return 
  new RestHighLevelClient(
      RestClient.builder(
        HttpHost.create(__elasticEndpointUrl__))
          .setHttpClientConfigCallback( hacb -> hacb.addInterceptorLast(__interceptorHere__))
          .setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(__timeOutHere__)
          .setSocketTimeout(__**putHighValueHere**__)));
like image 169
Habeeb Okunade Avatar answered Nov 01 '25 08:11

Habeeb Okunade



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!