diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java index bb4f8d154e8..9db2dfc7ac7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java @@ -143,6 +143,12 @@ public class LocalGateway extends AbstractLifecycleComponent implements listener.onSuccess(); return; } + if (electedState.state().metaData().indices().isEmpty()) { + logger.debug("no indices in metadata"); + listener.onSuccess(); + return; + } + logger.debug("elected state from [{}]", electedState.node()); final LocalGatewayMetaState state = electedState.state(); final AtomicInteger indicesCounter = new AtomicInteger(state.metaData().indices().size());