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

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

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

IndicesStatsRequestBuilder.execute介绍

暂无

代码示例

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

@Override
public IndicesStatsResponse get() {
 Profiler profiler = Profiler.createIfTrace(EsClient.LOGGER).start();
 try {
  return super.execute().actionGet();
 } catch (Exception e) {
  throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
 } finally {
  if (profiler.isTraceEnabled()) {
   profiler.stopTrace(toString());
  }
 }
}

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

@Test
public void execute_should_throw_an_unsupported_operation_exception() {
 try {
  es.client().prepareStats(FakeIndexDefinition.INDEX).execute();
  fail();
 } catch (Exception e) {
  assertThat(e).isInstanceOf(UnsupportedOperationException.class).hasMessage("execute() should not be called as it's used for asynchronous");
 }
}

代码示例来源: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
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: org.visallo/visallo-model-vertexium-elasticsearch

@Override
public String[] getManagedIndexNames(ElasticsearchSingleDocumentSearchIndex es) {
  Map<String, IndexStats> indices = es.getClient().admin().indices().prepareStats().execute().actionGet().getIndices();
  Set<String> indexNames = indices.keySet();
  return indexNames.toArray(new String[indexNames.size()]);
}

代码示例来源:origin: org.vertexium/vertexium-elasticsearch2

public Set<String> getIndexNamesFromElasticsearch() {
  return client.admin().indices().prepareStats().execute().actionGet().getIndices().keySet();
}

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

public Set<String> getIndexNamesFromElasticsearch() {
  return client.admin().indices().prepareStats().execute().actionGet().getIndices().keySet();
}

代码示例来源:origin: org.vertexium/vertexium-elasticsearch5

public Set<String> getIndexNamesFromElasticsearch() {
  return client.admin().indices().prepareStats().execute().actionGet().getIndices().keySet();
}

代码示例来源:origin: visallo/vertexium

public Set<String> getIndexNamesFromElasticsearch() {
  return client.admin().indices().prepareStats().execute().actionGet().getIndices().keySet();
}

代码示例来源:origin: lumifyio/securegraph

protected void loadIndexInfos() {
  Set<String> indicesToQuery = toSet(getConfig().getIndicesToQuery());
  Map<String, IndexStats> indices = client.admin().indices().prepareStats().execute().actionGet().getIndices();
  for (String indexName : indices.keySet()) {
    if (!indicesToQuery.contains(indexName)) {
      LOGGER.debug("skipping index " + indexName + ", not in indicesToQuery");
      continue;
    }
    IndexInfo indexInfo = indexInfos.get(indexName);
    if (indexInfo != null) {
      continue;
    }
    LOGGER.debug("loading index info for " + indexName);
    indexInfo = createIndexInfo(indexName);
    indexInfos.put(indexName, indexInfo);
  }
}

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

protected void loadIndexInfos() {
  Set<String> indicesToQuery = toSet(getConfig().getIndicesToQuery());
  Map<String, IndexStats> indices = client.admin().indices().prepareStats().execute().actionGet().getIndices();
  for (String indexName : indices.keySet()) {
    if (!indicesToQuery.contains(indexName)) {
      LOGGER.debug("skipping index " + indexName + ", not in indicesToQuery");
      continue;
    }
    IndexInfo indexInfo = indexInfos.get(indexName);
    if (indexInfo != null) {
      continue;
    }
    LOGGER.debug("loading index info for " + indexName);
    indexInfo = createIndexInfo(indexName);
    indexInfos.put(indexName, indexInfo);
  }
}

代码示例来源:origin: org.neolumin.vertexium/vertexium-elasticsearch-base

protected void loadIndexInfos() {
  Set<String> indicesToQuery = toSet(getConfig().getIndicesToQuery());
  Map<String, IndexStats> indices = client.admin().indices().prepareStats().execute().actionGet().getIndices();
  for (String indexName : indices.keySet()) {
    if (!indicesToQuery.contains(indexName)) {
      LOGGER.debug("skipping index " + indexName + ", not in indicesToQuery");
      continue;
    }
    IndexInfo indexInfo = indexInfos.get(indexName);
    if (indexInfo != null) {
      continue;
    }
    LOGGER.debug("loading index info for " + indexName);
    indexInfo = createIndexInfo(indexName);
    indexInfos.put(indexName, indexInfo);
  }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

@Override
public IndicesStatsResponse get() {
 Profiler profiler = Profiler.createIfTrace(EsClient.LOGGER).start();
 try {
  return super.execute().actionGet();
 } catch (Exception e) {
  throw new IllegalStateException(String.format("Fail to execute %s", toString()), e);
 } finally {
  if (profiler.isTraceEnabled()) {
   profiler.stopTrace(toString());
  }
 }
}

代码示例来源: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

相关文章