org.elasticsearch.client.RestHighLevelClient.clearScrollAsync()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中org.elasticsearch.client.RestHighLevelClient.clearScrollAsync方法的一些代码示例,展示了RestHighLevelClient.clearScrollAsync的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestHighLevelClient.clearScrollAsync方法的具体详情如下:
包路径:org.elasticsearch.client.RestHighLevelClient
类名称:RestHighLevelClient
方法名:clearScrollAsync

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.");
  }
 });
}

相关文章