@@ -75,16 +75,19 @@ public void testGetAdditionalIndexSettings() throws Exception {
7575 }
7676 }
7777 """ ;
78- Settings result = provider .getAdditionalIndexSettings (
78+ Settings .Builder additionalSettings = builder ();
79+ provider .getAdditionalIndexSettings (
7980 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
8081 dataStreamName ,
8182 IndexMode .TIME_SERIES ,
8283 projectMetadata ,
8384 now ,
8485 settings ,
8586 List .of (new CompressedXContent (mapping )),
87+ additionalSettings ,
8688 (k , v ) -> {}
8789 );
90+ Settings result = additionalSettings .build ();
8891 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
8992 // (in production the index.mode setting is usually provided in an index or component template)
9093 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -121,16 +124,19 @@ public void testGetAdditionalIndexSettingsIndexRoutingPathAlreadyDefined() throw
121124 }
122125 }
123126 """ ;
124- Settings result = provider .getAdditionalIndexSettings (
127+ Settings .Builder additionalSettings = builder ();
128+ provider .getAdditionalIndexSettings (
125129 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
126130 dataStreamName ,
127131 IndexMode .TIME_SERIES ,
128132 projectMetadata ,
129133 now ,
130134 settings ,
131135 List .of (new CompressedXContent (mapping )),
136+ additionalSettings ,
132137 (k , v ) -> {}
133138 );
139+ Settings result = additionalSettings .build ();
134140 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
135141 // (in production the index.mode setting is usually provided in an index or component template)
136142 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -192,16 +198,19 @@ public void testGetAdditionalIndexSettingsMappingsMerging() throws Exception {
192198 }
193199 }
194200 """ ;
195- Settings result = provider .getAdditionalIndexSettings (
201+ Settings .Builder additionalSettings = builder ();
202+ provider .getAdditionalIndexSettings (
196203 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
197204 dataStreamName ,
198205 IndexMode .TIME_SERIES ,
199206 projectMetadata ,
200207 now ,
201208 settings ,
202209 List .of (new CompressedXContent (mapping1 ), new CompressedXContent (mapping2 ), new CompressedXContent (mapping3 )),
210+ additionalSettings ,
203211 (k , v ) -> {}
204212 );
213+ Settings result = additionalSettings .build ();
205214 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
206215 // (in production the index.mode setting is usually provided in an index or component template)
207216 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -218,16 +227,19 @@ public void testGetAdditionalIndexSettingsNoMappings() {
218227
219228 Instant now = Instant .now ().truncatedTo (ChronoUnit .SECONDS );
220229 Settings settings = Settings .EMPTY ;
221- Settings result = provider .getAdditionalIndexSettings (
230+ Settings .Builder additionalSettings = builder ();
231+ provider .getAdditionalIndexSettings (
222232 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
223233 dataStreamName ,
224234 IndexMode .TIME_SERIES ,
225235 projectMetadata ,
226236 now ,
227237 settings ,
228238 List .of (),
239+ additionalSettings ,
229240 (k , v ) -> {}
230241 );
242+ Settings result = additionalSettings .build ();
231243 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
232244 // (in production the index.mode setting is usually provided in an index or component template)
233245 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -244,16 +256,19 @@ public void testGetAdditionalIndexSettingsLookAheadTime() throws Exception {
244256 Instant now = Instant .now ().truncatedTo (ChronoUnit .SECONDS );
245257 TimeValue lookAheadTime = TimeValue .timeValueMinutes (30 );
246258 Settings settings = builder ().put ("index.mode" , "time_series" ).put ("index.look_ahead_time" , lookAheadTime .getStringRep ()).build ();
247- Settings result = provider .getAdditionalIndexSettings (
259+ Settings .Builder additionalSettings = builder ();
260+ provider .getAdditionalIndexSettings (
248261 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
249262 dataStreamName ,
250263 IndexMode .TIME_SERIES ,
251264 projectMetadata ,
252265 now ,
253266 settings ,
254267 List .of (new CompressedXContent ("{}" )),
268+ additionalSettings ,
255269 (k , v ) -> {}
256270 );
271+ Settings result = additionalSettings .build ();
257272 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
258273 // (in production the index.mode setting is usually provided in an index or component template)
259274 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -270,16 +285,19 @@ public void testGetAdditionalIndexSettingsLookBackTime() throws Exception {
270285 Instant now = Instant .now ().truncatedTo (ChronoUnit .SECONDS );
271286 TimeValue lookBackTime = TimeValue .timeValueHours (12 );
272287 Settings settings = builder ().put ("index.mode" , "time_series" ).put ("index.look_back_time" , lookBackTime .getStringRep ()).build ();
273- Settings result = provider .getAdditionalIndexSettings (
288+ Settings .Builder additionalSettings = builder ();
289+ provider .getAdditionalIndexSettings (
274290 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
275291 dataStreamName ,
276292 IndexMode .TIME_SERIES ,
277293 projectMetadata ,
278294 now ,
279295 settings ,
280296 List .of (new CompressedXContent ("{}" )),
297+ additionalSettings ,
281298 (k , v ) -> {}
282299 );
300+ Settings result = additionalSettings .build ();
283301 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
284302 // (in production the index.mode setting is usually provided in an index or component template)
285303 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -303,16 +321,19 @@ public void testGetAdditionalIndexSettingsDataStreamAlreadyCreated() throws Exce
303321
304322 Instant now = sixHoursAgo .plus (6 , ChronoUnit .HOURS );
305323 Settings settings = Settings .EMPTY ;
306- var result = provider .getAdditionalIndexSettings (
324+ Settings .Builder additionalSettings = builder ();
325+ provider .getAdditionalIndexSettings (
307326 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
308327 dataStreamName ,
309328 IndexMode .TIME_SERIES ,
310329 projectMetadata ,
311330 now ,
312331 settings ,
313332 List .of (new CompressedXContent ("{}" )),
333+ additionalSettings ,
314334 (k , v ) -> {}
315335 );
336+ var result = additionalSettings .build ();
316337 assertThat (result .size (), equalTo (2 ));
317338 assertThat (result .get (IndexSettings .TIME_SERIES_START_TIME .getKey ()), equalTo (FORMATTER .format (currentEnd )));
318339 assertThat (
@@ -349,6 +370,7 @@ public void testGetAdditionalIndexSettingsDataStreamAlreadyCreatedTimeSettingsMi
349370 now ,
350371 settings ,
351372 null ,
373+ builder (),
352374 (k , v ) -> {}
353375 )
354376 );
@@ -368,16 +390,19 @@ public void testGetAdditionalIndexSettingsNonTsdbTemplate() {
368390 String dataStreamName = "logs-app1" ;
369391
370392 Settings settings = Settings .EMPTY ;
371- Settings result = provider .getAdditionalIndexSettings (
393+ Settings .Builder additionalSettings = builder ();
394+ provider .getAdditionalIndexSettings (
372395 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
373396 dataStreamName ,
374397 null ,
375398 projectMetadata ,
376399 Instant .ofEpochMilli (1L ),
377400 settings ,
378401 null ,
402+ additionalSettings ,
379403 (k , v ) -> {}
380404 );
405+ Settings result = additionalSettings .build ();
381406 assertThat (result .size (), equalTo (0 ));
382407 }
383408
@@ -391,16 +416,19 @@ public void testGetAdditionalIndexSettingsMigrateToTsdb() {
391416 .build ();
392417
393418 Settings settings = Settings .EMPTY ;
394- Settings result = provider .getAdditionalIndexSettings (
419+ Settings .Builder additionalSettings = builder ();
420+ provider .getAdditionalIndexSettings (
395421 DataStream .getDefaultBackingIndexName (dataStreamName , 2 ),
396422 dataStreamName ,
397423 IndexMode .TIME_SERIES ,
398424 projectMetadata ,
399425 now ,
400426 settings ,
401427 List .of (),
428+ additionalSettings ,
402429 (k , v ) -> {}
403430 );
431+ Settings result = additionalSettings .build ();
404432 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
405433 // (in production the index.mode setting is usually provided in an index or component template)
406434 result = builder ().put (result ).put ("index.mode" , "time_series" ).build ();
@@ -421,17 +449,19 @@ public void testGetAdditionalIndexSettingsDowngradeFromTsdb() {
421449 1
422450 );
423451
424- Settings settings = Settings . EMPTY ;
425- Settings result = provider .getAdditionalIndexSettings (
452+ Settings . Builder additionalSettings = builder () ;
453+ provider .getAdditionalIndexSettings (
426454 DataStream .getDefaultBackingIndexName (dataStreamName , 2 ),
427455 dataStreamName ,
428456 null ,
429457 projectMetadata ,
430458 Instant .ofEpochMilli (1L ),
431- settings ,
459+ Settings . EMPTY ,
432460 List .of (),
461+ additionalSettings ,
433462 (k , v ) -> {}
434463 );
464+ Settings result = additionalSettings .build ();
435465 assertThat (result .size (), equalTo (0 ));
436466 }
437467
@@ -702,16 +732,19 @@ private Settings generateTsdbSettings(String mapping, Instant now) throws IOExce
702732 String dataStreamName = "logs-app1" ;
703733 Settings settings = Settings .EMPTY ;
704734
705- var result = provider .getAdditionalIndexSettings (
735+ Settings .Builder additionalSettings = builder ();
736+ provider .getAdditionalIndexSettings (
706737 DataStream .getDefaultBackingIndexName (dataStreamName , 1 ),
707738 dataStreamName ,
708739 IndexMode .TIME_SERIES ,
709740 projectMetadata ,
710741 now ,
711742 settings ,
712743 List .of (new CompressedXContent (mapping )),
744+ additionalSettings ,
713745 (k , v ) -> {}
714746 );
747+ var result = additionalSettings .build ();
715748 // The index.time_series.end_time setting requires index.mode to be set to time_series adding it here so that we read this setting:
716749 // (in production the index.mode setting is usually provided in an index or component template)
717750 return builder ().put (result ).put ("index.mode" , "time_series" ).build ();
0 commit comments