Adding prefer_ilm as a whitelisted data stream setting (#128375)

This commit is contained in:
Keith Massey 2025-05-27 15:42:08 -05:00 committed by GitHub
parent 8484b71126
commit 41f186dca0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -33,6 +33,7 @@ import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.indices.SystemIndices;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.tasks.Task;
@ -53,7 +54,7 @@ public class TransportUpdateDataStreamSettingsAction extends TransportMasterNode
UpdateDataStreamSettingsAction.Request,
UpdateDataStreamSettingsAction.Response> {
private static final Logger logger = LogManager.getLogger(TransportUpdateDataStreamSettingsAction.class);
private static final Set<String> APPLY_TO_BACKING_INDICES = Set.of("index.lifecycle.name");
private static final Set<String> APPLY_TO_BACKING_INDICES = Set.of("index.lifecycle.name", IndexSettings.PREFER_ILM);
private static final Set<String> APPLY_TO_DATA_STREAM_ONLY = Set.of("index.number_of_shards");
private final MetadataDataStreamsService metadataDataStreamsService;
private final MetadataUpdateSettingsService updateSettingsService;

View file

@ -51,16 +51,20 @@ setup:
body:
index:
number_of_shards: 2
lifecycle.name: my-new-policy
lifecycle:
name: my-new-policy
prefer_ilm: true
- match: { data_streams.0.name: my-data-stream-1 }
- match: { data_streams.0.applied_to_data_stream: true }
- match: { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
- match: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: [index.lifecycle.name] }
- length: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: 2 }
- match: { data_streams.0.settings.index.number_of_shards: "2" }
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
- match: { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
- do:
indices.rollover:
@ -79,6 +83,7 @@ setup:
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
- match: { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
- do:
indices.get_data_stream:
@ -86,6 +91,7 @@ setup:
- match: { data_streams.0.name: my-data-stream-1 }
- match: { data_streams.0.settings.index.number_of_shards: "2" }
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
- match: { data_streams.0.effective_settings: null }
- do:
@ -101,6 +107,7 @@ setup:
- match: { .$idx0name.settings.index.lifecycle.name: "my-new-policy" }
- match: { .$idx1name.settings.index.number_of_shards: "2" }
- match: { .$idx1name.settings.index.lifecycle.name: "my-new-policy" }
- match: { .$idx1name.settings.index.lifecycle.prefer_ilm: "true" }
---
"Test multiple data streams":