org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse类的使用及代码示例

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

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

IndicesStatsResponse介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

private void completeIndexAttributes(ProtobufSystemInfo.Section.Builder protobuf) {
  IndicesStatsResponse indicesStats = esClient.prepareStats().all().get();
  for (Map.Entry<String, IndexStats> indexStats : indicesStats.getIndices().entrySet()) {
   String prefix = "Index " + indexStats.getKey() + " - ";
   setAttribute(protobuf, prefix + "Docs", indexStats.getValue().getPrimaries().getDocs().getCount());
   setAttribute(protobuf, prefix + "Shards", indexStats.getValue().getShards().length);
   setAttribute(protobuf, prefix + "Store Size", byteCountToDisplaySize(indexStats.getValue().getPrimaries().getStore().getSizeInBytes()));
  }
 }
}

代码示例来源:origin: apache/usergrid

private long getIndexSize(){
  long indexSize = 0L;
  final String indexName = indexLocationStrategy.getIndexInitialName();
  try {
    final IndicesStatsResponse statsResponse = esProvider.getClient()
      .admin()
      .indices()
      .prepareStats(indexName)
      .all()
      .execute()
      .actionGet();
    final CommonStats indexStats = statsResponse.getIndex(indexName).getTotal();
    indexSize = indexStats.getStore().getSizeInBytes();
  } catch (IndexMissingException e) {
    // if for some reason the index size does not exist,
    // log an error and we can assume size is 0 as it doesn't exist
    logger.error("Unable to get size for index {} due to IndexMissingException for app {}",
      indexName, indexLocationStrategy.getApplicationScope().getApplication().getUuid());
  }
  return indexSize;
}

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

@Override
public IndicesStatsResponse newResponse() {
  return new IndicesStatsResponse();
}

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

getPrimaries().toXContent(builder, params);
builder.endObject();
getTotal().toXContent(builder, params);
builder.endObject();
  for (IndexStats indexStats : getIndices().values()) {
    builder.startObject(indexStats.getIndex());
    builder.field("uuid", indexStats.getUuid());

代码示例来源:origin: com.scireum/sirius-search

private Map<String, String> getIndicesStatus(IndicesStatsResponse indicesStatsResponse) {
  Map<String, String> indexStatusMap = new HashMap<>();
  for (Map.Entry<String, IndexStats> indexStat : indicesStatsResponse.getIndices().entrySet()) {
    try (XContentBuilder indexStatsBuilder = XContentFactory.jsonBuilder()) {
      indexStatsBuilder.humanReadable(true).prettyPrint().startObject();
      indicesStatsResponse.getIndex(indexStat.getKey())
                .getTotal()
                .toXContent(indexStatsBuilder, ToXContent.EMPTY_PARAMS);
      indexStatsBuilder.endObject();
      indexStatusMap.put(indexStat.getKey(), indexStatsBuilder.string());
    } catch (IOException e) {
      Exceptions.handle(e);
    }
  }
  return indexStatusMap;
}

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

@Override
public void onResponse(IndicesStatsResponse indicesStatsResponse) {
  ShardStats[] stats = indicesStatsResponse.getShards();
  ImmutableOpenMap.Builder<String, Long> newShardSizes = ImmutableOpenMap.builder();
  ImmutableOpenMap.Builder<ShardRouting, String> newShardRoutingToDataPath = ImmutableOpenMap.builder();
  buildShardLevelInfo(logger, stats, newShardSizes, newShardRoutingToDataPath, clusterService.state());
  shardSizes = newShardSizes.build();
  shardRoutingToDataPath = newShardRoutingToDataPath.build();
}

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

ShardStats shardStats = stats.asMap().get(shard);
CommonStats commonStats = null;
CommitStats commitStats = null;

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

static Map<String, Boolean> evaluateConditions(final Collection<Condition> conditions, final IndexMetaData metaData,
                        final IndicesStatsResponse statsResponse) {
  return evaluateConditions(conditions, statsResponse.getPrimaries().getDocs(), metaData);
}

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

getPrimaries().toXContent(builder, params);
builder.endObject();
getTotal().toXContent(builder, params);
builder.endObject();
  for (IndexStats indexStats : getIndices().values()) {
    builder.startObject(indexStats.getIndex());

代码示例来源:origin: harbby/presto-connectors

@Override
public void onResponse(IndicesStatsResponse indicesStatsResponse) {
  ShardStats[] stats = indicesStatsResponse.getShards();
  final HashMap<String, Long> newShardSizes = new HashMap<>();
  final HashMap<ShardRouting, String> newShardRoutingToDataPath = new HashMap<>();
  buildShardLevelInfo(logger, stats, newShardSizes, newShardRoutingToDataPath, clusterService.state());
  shardSizes = Collections.unmodifiableMap(newShardSizes);
  shardRoutingToDataPath = Collections.unmodifiableMap(newShardRoutingToDataPath);
}

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

ShardStats shardStats = stats.asMap().get(shard);
CommonStats commonStats = null;
CommitStats commitStats = null;

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

static Map<String, Boolean> evaluateConditions(final Collection<Condition> conditions, final IndexMetaData metaData,
                        final IndicesStatsResponse statsResponse) {
  return evaluateConditions(conditions, statsResponse.getPrimaries().getDocs(), metaData);
}

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

public IndexStats getIndex(String index) {
  return getIndices().get(index);
}

代码示例来源:origin: harbby/presto-connectors

getPrimaries().toXContent(builder, params);
builder.endObject();
getTotal().toXContent(builder, params);
builder.endObject();
  for (IndexStats indexStats : getIndices().values()) {
    builder.startObject(indexStats.getIndex(), XContentBuilder.FieldCaseConversion.NONE);

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

@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
    )
  );
}

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

@Override
protected IndicesStatsResponse newResponse(IndicesStatsRequest request, int totalShards, int successfulShards, int failedShards,
                      List<ShardStats> responses, List<DefaultShardOperationFailedException> shardFailures,
                      ClusterState clusterState) {
  return new IndicesStatsResponse(responses.toArray(new ShardStats[responses.size()]), totalShards, successfulShards, failedShards,
    shardFailures);
}

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

@Override
public void onResponse(IndicesStatsResponse indicesStatsResponse) {
  ShardStats[] stats = indicesStatsResponse.getShards();
  ImmutableOpenMap.Builder<String, Long> newShardSizes = ImmutableOpenMap.builder();
  ImmutableOpenMap.Builder<ShardRouting, String> newShardRoutingToDataPath = ImmutableOpenMap.builder();
  buildShardLevelInfo(logger, stats, newShardSizes, newShardRoutingToDataPath, clusterService.state());
  shardSizes = newShardSizes.build();
  shardRoutingToDataPath = newShardRoutingToDataPath.build();
}

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

ShardStats shardStats = stats.asMap().get(shard);
CommonStats commonStats = null;
CommitStats commitStats = null;

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

static Set<Condition.Result> evaluateConditions(final Set<Condition> conditions, final IndexMetaData metaData,
                        final IndicesStatsResponse statsResponse) {
  return evaluateConditions(conditions, statsResponse.getPrimaries().getDocs(), metaData);
}

代码示例来源:origin: apache/metron

public boolean hasIndex(String indexName) {
 Set<String> indices = getClient().admin()
   .indices()
   .stats(new IndicesStatsRequest())
   .actionGet()
   .getIndices()
   .keySet();
 return indices.contains(indexName);
}

相关文章