diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java index 62ab74a5ab7..0f15df8215b 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java @@ -159,10 +159,16 @@ public class MetaDataIndexAliasesService extends AbstractComponent { if (changed) { ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build(); + // even though changes happened, they resulted in 0 actual changes to metadata + // i.e. remove and add the same alias to the same index + if (updatedState.metaData().aliases().equals(currentState.metaData().aliases())) { + listener.onResponse(new Response(true)); + return currentState; + } // wait for responses from other nodes if needed - int responseCount = updatedState.getNodes().size(); + int responseCount = updatedState.nodes().size(); long version = updatedState.version() + 1; - logger.trace("Waiting for [{}] notifications with version [{}]", responseCount, version); + logger.trace("waiting for [{}] notifications with version [{}]", responseCount, version); aliasOperationPerformedAction.add(new CountDownListener(responseCount, listener, version), request.timeout); return updatedState;