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 8d63ee5749887..90dab6d734520 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 Builder updateNumberOfReplicas(final int numberOfReplicas, final String[] builder.addReplica(); } } else if (currentNumberOfReplicas > 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());