【发布时间】:2021-04-05 19:05:21
【问题描述】:
当记录数较高时,以下代码在客户端(Elasticsearch 客户端)中返回超时。
CompletableFuture<BulkByScrollResponse> future = new CompletableFuture<>();
client.reindexAsync(request, RequestOptions.DEFAULT, new ActionListener<BulkByScrollResponse>() {
@Override
public void onResponse(BulkByScrollResponse bulkByScrollResponse) {
future.complete(bulkByScrollResponse);
}
@Override
public void onFailure(Exception e) {
future.completeExceptionally(e);
}
});
BulkByScrollResponse response = future.get(10, TimeUnit.MINUTES); // client timeout occured before this timeout
下面是客户端配置。
connectTimeout: 60000
socketTimeout: 600000
maxRetryTimeoutMillis: 600000
有没有办法无限期地等待重新索引完成?
【问题讨论】:
-
超时的 HTTP 代码是什么? 504?
-
没有。
Caused by: java.net.SocketTimeoutException: 600000 milliseconds timeout on connection http-outgoing-2 [ACTIVE] ... 11 common frames omitted
标签: java elasticsearch timeout reindex resthighlevelclient