@@ -299,3 +299,102 @@ setup:
299299 - match : { .$idx0name.settings.index.lifecycle.name: "my-policy" }
300300 - match : { .$idx1name.settings.index.number_of_shards: "1" }
301301 - match : { .$idx1name.settings.index.lifecycle.name: "my-policy" }
302+
303+ ---
304+ " Test null out settings " :
305+ - requires :
306+ cluster_features : [ "logs_stream" ]
307+ reason : requires setting 'logs_stream' to get or set data stream settings
308+ - do :
309+ allowed_warnings :
310+ - " index template [my-template] has index patterns [my-data-stream-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation"
311+ indices.put_index_template :
312+ name : my-template
313+ body :
314+ index_patterns : [ my-data-stream-* ]
315+ data_stream : { }
316+ template :
317+ settings :
318+ number_of_replicas : 0
319+ lifecycle.name : my-policy
320+
321+ - do :
322+ indices.create_data_stream :
323+ name : my-data-stream-1
324+
325+ - do :
326+ cluster.health :
327+ index : " my-data-stream-1"
328+ wait_for_status : green
329+
330+
331+
332+ - do :
333+ indices.get_data_stream :
334+ name : my-data-stream-1
335+ - match : { data_streams.0.name: my-data-stream-1 }
336+ - match : { data_streams.0.settings: {} }
337+ - match : { data_streams.0.effective_settings: null }
338+
339+ - do :
340+ indices.put_data_stream_settings :
341+ name : my-data-stream-1
342+ body :
343+ index :
344+ number_of_shards : 2
345+ lifecycle :
346+ name : my-new-policy
347+ prefer_ilm : true
348+ - match : { data_streams.0.name: my-data-stream-1 }
349+ - match : { data_streams.0.applied_to_data_stream: true }
350+ - match : { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
351+ - length : { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: 2 }
352+ - match : { data_streams.0.settings.index.number_of_shards: "2" }
353+ - match : { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
354+ - match : { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
355+ - match : { data_streams.0.effective_settings.index.number_of_shards: "2" }
356+ - match : { data_streams.0.effective_settings.index.number_of_replicas: "0" }
357+ - match : { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
358+ - match : { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
359+
360+ - do :
361+ indices.put_data_stream_settings :
362+ name : my-data-stream-1
363+ body :
364+ index :
365+ number_of_shards : null
366+ lifecycle :
367+ name : null
368+ - match : { data_streams.0.name: my-data-stream-1 }
369+ - match : { data_streams.0.applied_to_data_stream: true }
370+ - match : { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
371+ - length : { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: 1 }
372+ - match : { data_streams.0.settings.index.number_of_shards: null }
373+ - match : { data_streams.0.settings.index.lifecycle.name: null }
374+ - match : { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
375+ - match : { data_streams.0.effective_settings.index.number_of_shards: null }
376+ - match : { data_streams.0.effective_settings.index.number_of_replicas: "0" }
377+ - match : { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" }
378+ - match : { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
379+
380+ - do :
381+ indices.get_data_stream_settings :
382+ name : my-data-stream-1
383+ - match : { data_streams.0.name: my-data-stream-1 }
384+ - match : { data_streams.0.settings.index.lifecycle.name: null }
385+ - match : { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
386+ - match : { data_streams.0.effective_settings.index.number_of_shards: null }
387+ - match : { data_streams.0.effective_settings.index.number_of_replicas: "0" }
388+ - match : { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" }
389+
390+ - do :
391+ indices.get_data_stream :
392+ name : my-data-stream-1
393+ - set : { data_streams.0.indices.0.index_name: idx0name }
394+
395+ - do :
396+ indices.get_settings :
397+ index : my-data-stream-1
398+ - match : { .$idx0name.settings.index.number_of_shards: "1" }
399+ - match : { .$idx0name.settings.index.lifecycle.name: "my-policy" }
400+ - match : { .$idx0name.settings.index.lifecycle.prefer_ilm: "true" }
0 commit comments