diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/SystemIndexMetadataUpgradeService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/SystemIndexMetadataUpgradeService.java index f3e20291ccdae..c2960f0cb6285 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/SystemIndexMetadataUpgradeService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/SystemIndexMetadataUpgradeService.java @@ -104,6 +104,7 @@ public ClusterState execute(ClusterState currentState) throws Exception { boolean isHidden = indexMetadata.getSettings().getAsBoolean(IndexMetadata.SETTING_INDEX_HIDDEN, false); if (isSystem && isHidden == false) { builder.settings(Settings.builder().put(indexMetadata.getSettings()).put(IndexMetadata.SETTING_INDEX_HIDDEN, true)); + builder.settingsVersion(builder.settingsVersion() + 1); updated = true; } if (isSystem && indexMetadata.getAliases().values().stream().anyMatch(a -> Boolean.FALSE.equals(a.isHidden()))) { diff --git a/server/src/main/java/org/elasticsearch/index/IndexService.java b/server/src/main/java/org/elasticsearch/index/IndexService.java index d5b7ced702ff3..325678f93904a 100644 --- a/server/src/main/java/org/elasticsearch/index/IndexService.java +++ b/server/src/main/java/org/elasticsearch/index/IndexService.java @@ -784,9 +784,9 @@ public synchronized void updateMetadata(final IndexMetadata currentIndexMetadata final long currentSettingsVersion = currentIndexMetadata.getSettingsVersion(); final long newSettingsVersion = newIndexMetadata.getSettingsVersion(); if (currentSettingsVersion == newSettingsVersion) { - assert updateIndexSettings == false; + assert updateIndexSettings == false : "No index updates are expected as index settings version has not changed"; } else { - assert updateIndexSettings; + assert updateIndexSettings : "Index updates are expected as index settings version has changed"; assert currentSettingsVersion < newSettingsVersion : "expected current settings version [" + currentSettingsVersion