org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder.setDocs()方法的使用及代码示例

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

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

IndicesStatsRequestBuilder.setDocs介绍

暂无

代码示例

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

@Override
protected void masterOperation(final ResizeRequest resizeRequest, final ClusterState state,
                final ActionListener<ResizeResponse> listener) {
  // there is no need to fetch docs stats for split but we keep it simple and do it anyway for simplicity of the code
  final String sourceIndex = indexNameExpressionResolver.resolveDateMathExpression(resizeRequest.getSourceIndex());
  final String targetIndex = indexNameExpressionResolver.resolveDateMathExpression(resizeRequest.getTargetIndexRequest().index());
  client.admin().indices().prepareStats(sourceIndex).clear().setDocs(true).execute(new ActionListener<IndicesStatsResponse>() {
    @Override
    public void onResponse(IndicesStatsResponse indicesStatsResponse) {
      CreateIndexClusterStateUpdateRequest updateRequest = prepareCreateIndexRequest(resizeRequest, state,
        (i) -> {
          IndexShardStats shard = indicesStatsResponse.getIndex(sourceIndex).getIndexShards().get(i);
          return shard == null ? null : shard.getPrimary().getDocs();
        }, sourceIndex, targetIndex);
      createIndexService.createIndex(
        updateRequest,
        ActionListener.wrap(response ->
            listener.onResponse(new ResizeResponse(response.isAcknowledged(), response.isShardsAcknowledged(),
                updateRequest.index())), listener::onFailure
        )
      );
    }
    @Override
    public void onFailure(Exception e) {
      listener.onFailure(e);
    }
  });
}

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

client.admin().indices().prepareStats(sourceIndexName).clear().setDocs(true).execute(
  new ActionListener<IndicesStatsResponse>() {
    @Override

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
protected void masterOperation(final ShrinkRequest shrinkRequest, final ClusterState state,
                final ActionListener<ShrinkResponse> listener) {
  final String sourceIndex = indexNameExpressionResolver.resolveDateMathExpression(shrinkRequest.getSourceIndex());
  client.admin().indices().prepareStats(sourceIndex).clear().setDocs(true).execute(new ActionListener<IndicesStatsResponse>() {
    @Override
    public void onResponse(IndicesStatsResponse indicesStatsResponse) {
      CreateIndexClusterStateUpdateRequest updateRequest = prepareCreateIndexRequest(shrinkRequest, state,
        (i) -> {
          IndexShardStats shard = indicesStatsResponse.getIndex(sourceIndex).getIndexShards().get(i);
          return shard == null ? null : shard.getPrimary().getDocs();
        }, indexNameExpressionResolver);
      createIndexService.createIndex(updateRequest, ActionListener.wrap(response ->
        listener.onResponse(new ShrinkResponse(response.isAcknowledged(), response.isShardsAcked())), listener::onFailure));
    }
    @Override
    public void onFailure(Exception e) {
      listener.onFailure(e);
    }
  });
}

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

@Override
protected void masterOperation(final ResizeRequest resizeRequest, final ClusterState state,
                final ActionListener<ResizeResponse> listener) {
  // there is no need to fetch docs stats for split but we keep it simple and do it anyway for simplicity of the code
  final String sourceIndex = indexNameExpressionResolver.resolveDateMathExpression(resizeRequest.getSourceIndex());
  final String targetIndex = indexNameExpressionResolver.resolveDateMathExpression(resizeRequest.getTargetIndexRequest().index());
  client.admin().indices().prepareStats(sourceIndex).clear().setDocs(true).execute(new ActionListener<IndicesStatsResponse>() {
    @Override
    public void onResponse(IndicesStatsResponse indicesStatsResponse) {
      CreateIndexClusterStateUpdateRequest updateRequest = prepareCreateIndexRequest(resizeRequest, state,
        (i) -> {
          IndexShardStats shard = indicesStatsResponse.getIndex(sourceIndex).getIndexShards().get(i);
          return shard == null ? null : shard.getPrimary().getDocs();
        }, sourceIndex, targetIndex);
      createIndexService.createIndex(
        updateRequest,
        ActionListener.wrap(response ->
            listener.onResponse(new ResizeResponse(response.isAcknowledged(), response.isShardsAcknowledged(),
                updateRequest.index())), listener::onFailure
        )
      );
    }
    @Override
    public void onFailure(Exception e) {
      listener.onFailure(e);
    }
  });
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected void masterOperation(final ResizeRequest resizeRequest, final ClusterState state,
                final ActionListener<ResizeResponse> listener) {
  // there is no need to fetch docs stats for split but we keep it simple and do it anyway for simplicity of the code
  final String sourceIndex = indexNameExpressionResolver.resolveDateMathExpression(resizeRequest.getSourceIndex());
  final String targetIndex = indexNameExpressionResolver.resolveDateMathExpression(resizeRequest.getTargetIndexRequest().index());
  client.admin().indices().prepareStats(sourceIndex).clear().setDocs(true).execute(new ActionListener<IndicesStatsResponse>() {
    @Override
    public void onResponse(IndicesStatsResponse indicesStatsResponse) {
      CreateIndexClusterStateUpdateRequest updateRequest = prepareCreateIndexRequest(resizeRequest, state,
        (i) -> {
          IndexShardStats shard = indicesStatsResponse.getIndex(sourceIndex).getIndexShards().get(i);
          return shard == null ? null : shard.getPrimary().getDocs();
        }, sourceIndex, targetIndex);
      createIndexService.createIndex(
        updateRequest,
        ActionListener.wrap(response ->
            listener.onResponse(new ResizeResponse(response.isAcknowledged(), response.isShardsAcknowledged(),
                updateRequest.index())), listener::onFailure
        )
      );
    }
    @Override
    public void onFailure(Exception e) {
      listener.onFailure(e);
    }
  });
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

final String rolloverIndexName = indexNameExpressionResolver.resolveDateMathExpression(unresolvedName);
client.admin().indices().prepareStats(sourceIndexName).clear().setDocs(true).execute(
  new ActionListener<IndicesStatsResponse>() {
    @Override

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

client.admin().indices().prepareStats(sourceIndexName).clear().setDocs(true).execute(
  new ActionListener<IndicesStatsResponse>() {
    @Override

代码示例来源:origin: apache/servicemix-bundles

client.admin().indices().prepareStats(sourceIndexName).clear().setDocs(true).execute(
  new ActionListener<IndicesStatsResponse>() {
    @Override

相关文章