From 92d4cc13c064ffe2a289aa0e0cae049688aa8153 Mon Sep 17 00:00:00 2001 From: Andrew Raines Date: Fri, 24 Jan 2014 16:13:19 -0600 Subject: [PATCH] _cat/allocation: Guaranteed to have at least zero shards --- .../elasticsearch/rest/action/cat/RestAllocationAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index be8fe320dd7..fddf3cb0cb2 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -144,7 +144,7 @@ public class RestAllocationAction extends AbstractCatAction { for (NodeStats nodeStats : stats.getNodes()) { DiscoveryNode node = nodeStats.getNode(); - int shardCount = -1; + int shardCount = 0; if (allocs.containsKey(node.id())) { shardCount = allocs.lget(); } @@ -158,7 +158,7 @@ public class RestAllocationAction extends AbstractCatAction { } table.startRow(); - table.addCell(shardCount < 0 ? null : shardCount); + table.addCell(shardCount); table.addCell(used < 0 ? null : new ByteSizeValue(used)); table.addCell(avail < 0 ? null : new ByteSizeValue(avail)); table.addCell(nodeStats.getFs().getTotal().getTotal());