update version on ILM setting updates

This commit is contained in:
Tal Levy 2018-10-16 15:43:10 -07:00
parent fbe8dc014c
commit 3a555da34d
1 changed files with 4 additions and 2 deletions

View File

@ -513,7 +513,9 @@ public class IndexLifecycleRunner {
Settings.Builder newSettings = Settings.builder().put(indexMetadata.getSettings()); Settings.Builder newSettings = Settings.builder().put(indexMetadata.getSettings());
newSettings.put(LifecycleSettings.LIFECYCLE_NAME_SETTING.getKey(), newPolicyName); newSettings.put(LifecycleSettings.LIFECYCLE_NAME_SETTING.getKey(), newPolicyName);
return IndexMetaData.builder(indexMetadata).settings(newSettings).putCustom(ILM_CUSTOM_METADATA_KEY, newState.asMap()); return IndexMetaData.builder(indexMetadata)
.settings(newSettings).putCustom(ILM_CUSTOM_METADATA_KEY, newState.asMap())
.settingsVersion(1 + indexMetadata.getSettingsVersion());
} }
public static ClusterState removePolicyForIndexes(final Index[] indices, ClusterState currentState, List<String> failedIndexes) { public static ClusterState removePolicyForIndexes(final Index[] indices, ClusterState currentState, List<String> failedIndexes) {
@ -551,7 +553,7 @@ public class IndexLifecycleRunner {
IndexMetaData.Builder builder = IndexMetaData.builder(indexMetadata); IndexMetaData.Builder builder = IndexMetaData.builder(indexMetadata);
builder.removeCustom(ILM_CUSTOM_METADATA_KEY); builder.removeCustom(ILM_CUSTOM_METADATA_KEY);
return builder.settings(newSettings); return builder.settings(newSettings).settingsVersion(1 + indexMetadata.getSettingsVersion());
} }
private void markPolicyDoesNotExist(String policyName, Index index, LifecycleExecutionState executionState) { private void markPolicyDoesNotExist(String policyName, Index index, LifecycleExecutionState executionState) {