use of org.elasticsearch.action.admin.indices.stats.IndexStats in project sonarqube by SonarSource.
the class EsMonitor method indexAttributes.
private LinkedHashMap<String, LinkedHashMap<String, Object>> indexAttributes() {
LinkedHashMap<String, LinkedHashMap<String, Object>> indices = new LinkedHashMap<>();
IndicesStatsResponse indicesStats = esClient.prepareStats().all().get();
for (Map.Entry<String, IndexStats> indexStats : indicesStats.getIndices().entrySet()) {
LinkedHashMap<String, Object> attributes = new LinkedHashMap<>();
indices.put(indexStats.getKey(), attributes);
attributes.put("Docs", indexStats.getValue().getPrimaries().getDocs().getCount());
attributes.put("Shards", indexStats.getValue().getShards().length);
attributes.put("Store Size", byteCountToDisplaySize(indexStats.getValue().getPrimaries().getStore().getSizeInBytes()));
}
return indices;
}
Aggregations