use of org.graylog2.indexer.indices.stats.IndexStatistics in project graylog2-server by Graylog2.
the class IndicesResource method getOpenIndicesInfo.
private OpenIndicesInfo getOpenIndicesInfo(Set<IndexStatistics> indicesStatistics) {
final Map<String, IndexInfo> indexInfos = new HashMap<>();
final Set<String> indices = indicesStatistics.stream().map(IndexStatistics::index).collect(Collectors.toSet());
final Map<String, Boolean> areReopened = this.indices.areReopened(indices);
for (IndexStatistics indexStatistics : indicesStatistics) {
final IndexInfo indexInfo = IndexInfo.create(indexStatistics.primaryShards(), indexStatistics.allShards(), fillShardRoutings(indexStatistics.routing()), areReopened.get(indexStatistics.index()));
indexInfos.put(indexStatistics.index(), indexInfo);
}
return OpenIndicesInfo.create(indexInfos);
}
use of org.graylog2.indexer.indices.stats.IndexStatistics in project graylog2-server by Graylog2.
the class IndicesResource method indexSetOpen.
@GET
@Path("/{indexSetId}/open")
@Timed
@ApiOperation(value = "Get information of all open indices managed by Graylog and their shards.")
@RequiresPermissions(RestPermissions.INDICES_READ)
@Produces(MediaType.APPLICATION_JSON)
public OpenIndicesInfo indexSetOpen(@ApiParam(name = "indexSetId") @PathParam("indexSetId") String indexSetId) {
final IndexSet indexSet = getIndexSet(indexSetRegistry, indexSetId);
final Set<IndexStatistics> indicesInfos = indices.getIndicesStats(indexSet).stream().filter(indexStats -> isPermitted(RestPermissions.INDICES_READ, indexStats.index())).collect(Collectors.toSet());
return getOpenIndicesInfo(indicesInfos);
}
use of org.graylog2.indexer.indices.stats.IndexStatistics in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method indicesStats.
@Override
public Set<IndexStatistics> indicesStats(Collection<String> indices) {
final ImmutableSet.Builder<IndexStatistics> result = ImmutableSet.builder();
final JsonNode allWithShardLevel = getAllWithShardLevel(indices);
final Iterator<Map.Entry<String, JsonNode>> fields = allWithShardLevel.fields();
while (fields.hasNext()) {
final Map.Entry<String, JsonNode> entry = fields.next();
final String index = entry.getKey();
final JsonNode indexStats = entry.getValue();
if (indexStats.isObject()) {
result.add(buildIndexStatistics(index, indexStats));
}
}
return result.build();
}
Aggregations