gpt4 book ai didi

java - ElasticSearch - RestHighLevelClient - 等待 [30000] 毫秒后监听器超时

转载 作者:行者123 更新时间:2023-12-02 22:15:53 30 4
gpt4 key购买 nike

当索引 100k 文档时,以下行出现 listener 超时异常

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

请找到完整的堆栈跟踪

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)

最佳答案

试试这个,它对我有用

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

关于java - ElasticSearch - RestHighLevelClient - 等待 [30000] 毫秒后监听器超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51341806/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com