本文整理了Java中org.elasticsearch.client.RestHighLevelClient.clearScrollAsync
方法的一些代码示例,展示了RestHighLevelClient.clearScrollAsync
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestHighLevelClient.clearScrollAsync
方法的具体详情如下:
包路径:org.elasticsearch.client.RestHighLevelClient
类名称:RestHighLevelClient
方法名:clearScrollAsync
[英]Asynchronously clears one or more scroll ids using the Clear Scroll API. See Clear Scroll API on elastic.co
[中]使用Clear scroll API异步清除一个或多个滚动ID。见Clear Scroll API on elastic.co
代码示例来源:origin: io.reactiverse/elasticsearch-client
@Override()
public void clearScrollAsync(ClearScrollRequest clearScrollRequest, RequestOptions options, Handler<AsyncResult<ClearScrollResponse>> handler) {
Context context = vertx.getOrCreateContext();
delegate.clearScrollAsync(clearScrollRequest, options, new ActionListener<ClearScrollResponse>() {
@Override
public void onResponse(ClearScrollResponse value) {
context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
}
@Override
public void onFailure(Exception e) {
context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
}
});
}
代码示例来源:origin: mnemonic-no/act-platform
private void closeSearchContext(String scrollId) {
ClearScrollRequest request = new ClearScrollRequest();
request.addScrollId(scrollId);
// Perform this clean-up asynchronously because the client doesn't require the result.
clientFactory.getHighLevelClient().clearScrollAsync(request, new ActionListener<ClearScrollResponse>() {
@Override
public void onResponse(ClearScrollResponse response) {
if (!response.isSucceeded()) {
LOGGER.warning("Could not close search context (response code %s).", response.status());
} else {
LOGGER.debug("Successfully closed search context.");
}
}
@Override
public void onFailure(Exception ex) {
LOGGER.warning(ex, "Could not close search context.");
}
});
}
内容来源于网络,如有侵权,请联系作者删除!