From d086648cec181130ccf95ff804880af29e60cb0c Mon Sep 17 00:00:00 2001 From: Leonardo Menezes Date: Tue, 24 Mar 2015 19:29:13 +0100 Subject: [PATCH] Cat api: added node id column to _cat/segments response Relates to #10226 --- rest-api-spec/test/cat.segments/10_basic.yaml | 1 + .../org/elasticsearch/rest/action/cat/RestSegmentsAction.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/rest-api-spec/test/cat.segments/10_basic.yaml b/rest-api-spec/test/cat.segments/10_basic.yaml index 1de18fbcae1..b64d14ebd50 100755 --- a/rest-api-spec/test/cat.segments/10_basic.yaml +++ b/rest-api-spec/test/cat.segments/10_basic.yaml @@ -10,6 +10,7 @@ shard .+ \n prirep .+ \n ip .+ \n + id .+ \n segment .+ \n generation .+ \n docs.count .+ \n diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index b2b42bd2d87..5c6a3e3bf1b 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -88,6 +88,7 @@ public class RestSegmentsAction extends AbstractCatAction { table.addCell("shard", "default:true;alias:s,sh;desc:shard name"); table.addCell("prirep", "alias:p,pr,primaryOrReplica;default:true;desc:primary or replica"); table.addCell("ip", "default:true;desc:ip of node where it lives"); + table.addCell("id", "default:false;desc:unique id node where it lives"); table.addCell("segment", "default:true;alias:seg;desc:segment name"); table.addCell("generation", "default:true;alias:g,gen;text-align:right;desc:segment generation"); table.addCell("docs.count", "default:true;alias:dc,docsCount;text-align:right;desc:number of docs in segment"); @@ -123,6 +124,7 @@ public class RestSegmentsAction extends AbstractCatAction { table.addCell(shardSegment.getShardId()); table.addCell(shardSegment.getShardRouting().primary() ? "p" : "r"); table.addCell(nodes.get(shardSegment.getShardRouting().currentNodeId()).getHostAddress()); + table.addCell(shardSegment.getShardRouting().currentNodeId()); table.addCell(segment.getName()); table.addCell(segment.getGeneration()); table.addCell(segment.getNumDocs());