yexu
yexu

Reputation: 41

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]

Upvotes: 4

Views: 10094

Answers (1)

Habeeb Okunade
Habeeb Okunade

Reputation: 281

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**__)));

Upvotes: 2

Related Questions