Skip to content

Commit 970d9b7

Browse files
masseykejoegallo
authored andcommitted
Adding prefer_ilm as a whitelisted data stream setting (#128375)
1 parent 27e9f8e commit 970d9b7

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportUpdateDataStreamSettingsAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.elasticsearch.common.util.concurrent.EsExecutors;
3232
import org.elasticsearch.core.TimeValue;
3333
import org.elasticsearch.index.Index;
34+
import org.elasticsearch.index.IndexSettings;
3435
import org.elasticsearch.indices.SystemIndices;
3536
import org.elasticsearch.injection.guice.Inject;
3637
import org.elasticsearch.tasks.Task;
@@ -51,7 +52,7 @@ public class TransportUpdateDataStreamSettingsAction extends TransportMasterNode
5152
UpdateDataStreamSettingsAction.Request,
5253
UpdateDataStreamSettingsAction.Response> {
5354
private static final Logger logger = LogManager.getLogger(TransportUpdateDataStreamSettingsAction.class);
54-
private static final Set<String> APPLY_TO_BACKING_INDICES = Set.of("index.lifecycle.name");
55+
private static final Set<String> APPLY_TO_BACKING_INDICES = Set.of("index.lifecycle.name", IndexSettings.PREFER_ILM);
5556
private static final Set<String> APPLY_TO_DATA_STREAM_ONLY = Set.of("index.number_of_shards");
5657
private final MetadataDataStreamsService metadataDataStreamsService;
5758
private final MetadataUpdateSettingsService updateSettingsService;

modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/240_data_stream_settings.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,20 @@ setup:
5151
body:
5252
index:
5353
number_of_shards: 2
54-
lifecycle.name: my-new-policy
54+
lifecycle:
55+
name: my-new-policy
56+
prefer_ilm: true
5557
- match: { data_streams.0.name: my-data-stream-1 }
5658
- match: { data_streams.0.applied_to_data_stream: true }
5759
- match: { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
58-
- match: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: [index.lifecycle.name] }
60+
- length: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: 2 }
5961
- match: { data_streams.0.settings.index.number_of_shards: "2" }
6062
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
63+
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
6164
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
6265
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
6366
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
67+
- match: { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
6468

6569
- do:
6670
indices.rollover:
@@ -79,13 +83,15 @@ setup:
7983
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
8084
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
8185
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
86+
- match: { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
8287

8388
- do:
8489
indices.get_data_stream:
8590
name: my-data-stream-1
8691
- match: { data_streams.0.name: my-data-stream-1 }
8792
- match: { data_streams.0.settings.index.number_of_shards: "2" }
8893
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
94+
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
8995
- match: { data_streams.0.effective_settings: null }
9096

9197
- do:
@@ -101,6 +107,7 @@ setup:
101107
- match: { .$idx0name.settings.index.lifecycle.name: "my-new-policy" }
102108
- match: { .$idx1name.settings.index.number_of_shards: "2" }
103109
- match: { .$idx1name.settings.index.lifecycle.name: "my-new-policy" }
110+
- match: { .$idx1name.settings.index.lifecycle.prefer_ilm: "true" }
104111

105112
---
106113
"Test multiple data streams":

0 commit comments

Comments
 (0)