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);
Author by
Karthikeyan
Updated on June 05, 2022Comments
-
Karthikeyan almost 2 years
While indexing
100k
doucments am gettinglistener
timeout exception for the below lineIndexResponse 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 almost 6 yearsMaybe use bulk api ? see elastic.co/guide/en/elasticsearch/client/java-rest/master/…
-
Val almost 6 yearsMaybe send smaller bulk queries with less documents.
-
Karthikeyan almost 6 years@Val - i solved this problem by adding
setMaxRetryTimeoutMillis(90000000)
while creating instance forRestHighLevelClient
. But now am facingjava.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 almost 6 yearsIncreasing the timeout is probably not the solution, you need to send smaller bulks.
-
Karthikeyan almost 6 years@Val - do you have any examples for smaller bulk?
-
Val almost 6 yearssimply send less data in your bulk request
-
Karthikeyan almost 6 years@Val - I have raised a separate question for the same in detail.
-