private List<Map<String, Object>> getShardInformation(IndexStats stats) {
List<Map<String, Object>> shards = Lists.newArrayList();
for(Map.Entry<Integer, IndexShardStats> s : stats.getIndexShards().entrySet()) {
Iterator<ShardStats> iter = s.getValue().iterator();
while (iter.hasNext()) {
ShardStats ss = iter.next();
Map<String, Object> shard = Maps.newHashMap();
shard.put("node_hostname", cluster.nodeIdToHostName(ss.getShardRouting().currentNodeId()));
shard.put("node_name", cluster.nodeIdToName(ss.getShardRouting().currentNodeId()));
shard.put("id", ss.getShardId());
shard.put("node_id", ss.getShardRouting().currentNodeId());
shard.put("primary", ss.getShardRouting().primary());
shard.put("is_initializing", ss.getShardRouting().initializing());
shard.put("is_started", ss.getShardRouting().started());
shard.put("is_unassigned", ss.getShardRouting().unassigned());
shard.put("is_relocating", ss.getShardRouting().relocating());
shard.put("relocating_to", cluster.nodeIdToName(ss.getShardRouting().relocatingNodeId()));
shards.add(shard);
}
}