diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java b/server/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java index 8d63ee57498..90dab6d7345 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java @@ -477,13 +477,8 @@ public class RoutingTable implements Iterable, Diffable numberOfReplicas) { - int delta = currentNumberOfReplicas - numberOfReplicas; - if (delta <= 0) { - // ignore, can't remove below the current one... - } else { - for (int i = 0; i < delta; i++) { - builder.removeReplica(); - } + for (int i = 0; i < (currentNumberOfReplicas - numberOfReplicas); i++) { + builder.removeReplica(); } } indicesRouting.put(index, builder.build());