ElasticSearch - RestHighLevelClient - listener timeout after waiting for [30000] ms

12,225

Try this, it works with me

RestClientBuilder builder = RestClient.builder(
                new HttpHost(HOST, PORT))
                .setRequestConfigCallback(
                    new RestClientBuilder.RequestConfigCallback() {
                        @Override
                        public RequestConfig.Builder customizeRequestConfig(
                                RequestConfig.Builder requestConfigBuilder) {
                            return requestConfigBuilder
                                .setConnectTimeout(5000)
                                .setSocketTimeout(60000);
                        }
                    }).setMaxRetryTimeoutMillis(60000);
Share:
12,225
Karthikeyan
Author by

Karthikeyan

Updated on June 05, 2022

Comments

  • Karthikeyan
    Karthikeyan almost 2 years

    While indexing 100k doucments am getting listener timeout exception for the below line

    IndexResponse response = SearchEngineClient.getInstance2().index(request);
    

    Please find the complete stack trace

    Exception in thread "main" java.io.IOException: listener timeout after waiting f
    or [30000] ms
            at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClie
    nt.java:663)
            at org.elasticsearch.client.RestClient.performRequest(RestClient.java:22
    2)
            at org.elasticsearch.client.RestClient.performRequest(RestClient.java:19
    4)
            at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighL
    evelClient.java:443)
            at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEn
    tity(RestHighLevelClient.java:429)
            at org.elasticsearch.client.RestHighLevelClient.index(RestHighLevelClien
    t.java:312)
            at com.es.utility.DocumentIndex.main(DocumentIndex.java:255)
    
    • chomp
      chomp almost 6 years
    • Val
      Val almost 6 years
      Maybe send smaller bulk queries with less documents.
    • Karthikeyan
      Karthikeyan almost 6 years
      @Val - i solved this problem by adding setMaxRetryTimeoutMillis(90000000) while creating instance for RestHighLevelClient. But now am facing java.io.IOException: An existing connection was forcibly closed by the remote host issue. i have created a separate question for the same stackoverflow.com/questions/51348939/…
    • Val
      Val almost 6 years
      Increasing the timeout is probably not the solution, you need to send smaller bulks.
    • Karthikeyan
      Karthikeyan almost 6 years
      @Val - do you have any examples for smaller bulk?
    • Val
      Val almost 6 years
      simply send less data in your bulk request
    • Karthikeyan
      Karthikeyan almost 6 years
      @Val - I have raised a separate question for the same in detail.