use of io.searchbox.indices.Stats in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method indexStatsWithShardLevel.
private JsonNode indexStatsWithShardLevel(final String indexName) {
final Stats request = new Stats.Builder().addIndex(indexName).setParameter("level", "shards").ignoreUnavailable(true).build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't check stats of index " + indexName);
return jestResult.getJsonObject().path("indices").path(indexName);
}
use of io.searchbox.indices.Stats in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method storeSizeInBytes.
@Override
public Optional<Long> storeSizeInBytes(String index) {
final Stats request = new Stats.Builder().addIndex(index).store(true).build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't check store stats of index " + index);
final JsonNode sizeInBytes = jestResult.getJsonObject().path("indices").path(index).path("primaries").path("store").path("size_in_bytes");
return Optional.of(sizeInBytes).filter(JsonNode::isNumber).map(JsonNode::asLong);
}
use of io.searchbox.indices.Stats in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method getAllWithShardLevel.
private JsonNode getAllWithShardLevel(final Collection<String> indices) {
final Stats request = new Stats.Builder().addIndex(indices).setParameter("level", "shards").build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't fetch index stats of indices " + indices);
final JsonNode responseJson = jestResult.getJsonObject();
final int failedShards = responseJson.path("_shards").path("failed").asInt();
if (failedShards > 0) {
throw new ElasticsearchException("Index stats response contains failed shards, response is incomplete");
}
return responseJson.path("indices");
}
use of io.searchbox.indices.Stats in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method getIndexStats.
@Override
public JsonNode getIndexStats(final Collection<String> indices) {
final Stats request = new Stats.Builder().addIndex(indices).docs(true).store(true).build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't check stats of indices " + indices);
return jestResult.getJsonObject().path("indices");
}
use of io.searchbox.indices.Stats in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method indexStats.
private JsonNode indexStats(final String indexName) {
final Stats request = new Stats.Builder().addIndex(indexName).build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't check stats of index " + indexName);
return jestResult.getJsonObject().path("indices").path(indexName);
}
Aggregations