use of org.graylog2.rest.models.system.indexer.responses.OpenIndicesInfo in project graylog2-server by Graylog2.
the class IndicesResource method getOpenIndicesInfo.
private OpenIndicesInfo getOpenIndicesInfo(Set<IndexStatistics> indicesStats) {
final Map<String, IndexInfo> indexInfos = new HashMap<>();
final Map<String, Boolean> areReopened = indices.areReopened(indicesStats.stream().map(IndexStatistics::indexName).collect(Collectors.toSet()));
for (IndexStatistics indexStatistics : indicesStats) {
final ImmutableList.Builder<ShardRouting> routing = ImmutableList.builder();
for (org.elasticsearch.cluster.routing.ShardRouting shardRouting : indexStatistics.shardRoutings()) {
routing.add(shardRouting(shardRouting));
}
final IndexInfo indexInfo = IndexInfo.create(indexStats(indexStatistics.primaries()), indexStats(indexStatistics.total()), routing.build(), areReopened.get(indexStatistics.indexName()));
indexInfos.put(indexStatistics.indexName(), indexInfo);
}
return OpenIndicesInfo.create(indexInfos);
}
use of org.graylog2.rest.models.system.indexer.responses.OpenIndicesInfo 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> indicesStats = indices.getIndicesStats(indexSet).stream().filter(indexStats -> indexSetRegistry.isManagedIndex(indexStats.indexName())).collect(Collectors.toSet());
return getOpenIndicesInfo(indicesStats);
}
Aggregations