org.elasticsearch.indices.IndicesService.getRewriteContext()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(124)

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

IndicesService.getRewriteContext介绍

[英]Returns a new QueryRewriteContext with the given now provider
[中]

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Returns a new {@link QueryRewriteContext} with the given {@code now} provider
 */
public QueryRewriteContext getRewriteContext(LongSupplier nowInMillis) {
  return indicesService.getRewriteContext(nowInMillis);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void rewriteShardRequest(ShardSearchRequest request, ActionListener<ShardSearchRequest> listener) {
  IndexShard shard = indicesService.indexServiceSafe(request.shardId().getIndex()).getShard(request.shardId().id());
  Executor executor = getExecutor(shard);
  // we also do rewrite on the coordinating node (TransportSearchService) but we also need to do it here for BWC as well as
  // AliasFilters that might need to be rewritten. These are edge-cases but we are every efficient doing the rewrite here so it's not
  // adding a lot of overhead
  Rewriteable.rewriteAndFetch(request.getRewriteable(), indicesService.getRewriteContext(request::nowInMillis),
    ActionListener.wrap(r ->
        executor.execute(new AbstractRunnable() {
          @Override
          public void onFailure(Exception e) {
            listener.onFailure(e);
          }
          @Override
          protected void doRun() {
            listener.onResponse(request);
          }
        }), listener::onFailure));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns a new {@link QueryRewriteContext} with the given {@code now} provider
 */
public QueryRewriteContext getRewriteContext(LongSupplier nowInMillis) {
  return indicesService.getRewriteContext(nowInMillis);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void rewriteShardRequest(ShardSearchRequest request, ActionListener<ShardSearchRequest> listener) {
  IndexShard shard = indicesService.indexServiceSafe(request.shardId().getIndex()).getShard(request.shardId().id());
  Executor executor = getExecutor(shard);
  // we also do rewrite on the coordinating node (TransportSearchService) but we also need to do it here for BWC as well as
  // AliasFilters that might need to be rewritten. These are edge-cases but we are every efficient doing the rewrite here so it's not
  // adding a lot of overhead
  Rewriteable.rewriteAndFetch(request.getRewriteable(), indicesService.getRewriteContext(request::nowInMillis),
    ActionListener.wrap(r ->
        executor.execute(new AbstractRunnable() {
          @Override
          public void onFailure(Exception e) {
            listener.onFailure(e);
          }
          @Override
          protected void doRun() {
            listener.onResponse(request);
          }
        }), listener::onFailure));
}

相关文章

微信公众号

最新文章

更多