diff --git a/rest-api-spec/test/cat.shards/10_basic.yaml b/rest-api-spec/test/cat.shards/10_basic.yaml index ce3145b83b5..8063bf3d040 100755 --- a/rest-api-spec/test/cat.shards/10_basic.yaml +++ b/rest-api-spec/test/cat.shards/10_basic.yaml @@ -1,4 +1,73 @@ --- +"Help": + - do: + cat.shards: + help: true + + - match: + $body: | + /^ index .+ \n + shard .+ \n + prirep .+ \n + state .+ \n + docs .+ \n + store .+ \n + ip .+ \n + id .+ \n + node .+ \n + completion.size .+ \n + fielddata.memory_size .+ \n + fielddata.evictions .+ \n + filter_cache.memory_size .+ \n + filter_cache.evictions .+ \n + flush.total .+ \n + flush.total_time .+ \n + get.current .+ \n + get.time .+ \n + get.total .+ \n + get.exists_time .+ \n + get.exists_total .+ \n + get.missing_time .+ \n + get.missing_total .+ \n + id_cache.memory_size .+ \n + indexing.delete_current .+ \n + indexing.delete_time .+ \n + indexing.delete_total .+ \n + indexing.index_current .+ \n + indexing.index_time .+ \n + indexing.index_total .+ \n + merges.current .+ \n + merges.current_docs .+ \n + merges.current_size .+ \n + merges.total .+ \n + merges.total_docs .+ \n + merges.total_size .+ \n + merges.total_time .+ \n + percolate.current .+ \n + percolate.memory_size .+ \n + percolate.queries .+ \n + percolate.time .+ \n + percolate.total .+ \n + refresh.total .+ \n + refresh.time .+ \n + search.fetch_current .+ \n + search.fetch_time .+ \n + search.fetch_total .+ \n + search.open_contexts .+ \n + search.query_current .+ \n + search.query_time .+ \n + search.query_total .+ \n + segments.count .+ \n + segments.memory .+ \n + segments.index_writer_memory .+ \n + segments.index_writer_max_memory .+ \n + segments.version_map_memory .+ \n + segments.fixed_bitset_memory .+ \n + warmer.current .+ \n + warmer.total .+ \n + warmer.total_time .+ \n + $/ +--- "Test cat shards output": - do: diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index 975416c70db..0a32ac6771d 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -86,6 +86,7 @@ public class RestShardsAction extends AbstractCatAction { .addCell("docs", "alias:d,dc;text-align:right;desc:number of docs in shard") .addCell("store", "alias:sto;text-align:right;desc:store size of shard (how much disk it uses)") .addCell("ip", "default:true;desc:ip of node where it lives") + .addCell("id", "default:false;desc:unique id of node where it lives") .addCell("node", "default:true;alias:n;desc:name of node where it lives"); table.addCell("completion.size", "alias:cs,completionSize;default:false;text-align:right;desc:size of completion"); @@ -186,21 +187,27 @@ public class RestShardsAction extends AbstractCatAction { table.addCell(shardStats == null ? null : shardStats.getStore().getSize()); if (shard.assignedToNode()) { String ip = state.getState().nodes().get(shard.currentNodeId()).getHostAddress(); + String nodeId = shard.currentNodeId(); StringBuilder name = new StringBuilder(); name.append(state.getState().nodes().get(shard.currentNodeId()).name()); if (shard.relocating()) { String reloIp = state.getState().nodes().get(shard.relocatingNodeId()).getHostAddress(); String reloNme = state.getState().nodes().get(shard.relocatingNodeId()).name(); + String reloNodeId = shard.relocatingNodeId(); name.append(" -> "); name.append(reloIp); name.append(" "); + name.append(reloNodeId); + name.append(" "); name.append(reloNme); } table.addCell(ip); + table.addCell(nodeId); table.addCell(name); } else { table.addCell(null); table.addCell(null); + table.addCell(null); } table.addCell(shardStats == null ? null : shardStats.getCompletion().getSize());