@@ -220,11 +220,14 @@ public void testCreateDataExtractorFactoryGivenRollupAndValidAggregation() {
220
220
MaxAggregationBuilder myField = AggregationBuilders .max ("myField" ).field ("myField" );
221
221
TermsAggregationBuilder myTerm = AggregationBuilders .terms ("termAgg" ).field ("termField" ).subAggregation (myField );
222
222
datafeedConfig .setParsedAggregations (AggregatorFactories .builder ().addAggregator (
223
- AggregationBuilders .dateHistogram ("time" ).interval (600_000 ).subAggregation (maxTime ).subAggregation (myTerm ).field ("time" )));
223
+ AggregationBuilders .dateHistogram ("time" )
224
+ .fixedInterval (new DateHistogramInterval ("600000ms" ))
225
+ .subAggregation (maxTime )
226
+ .subAggregation (myTerm )
227
+ .field ("time" )));
224
228
ActionListener <DataExtractorFactory > listener = ActionListener .wrap (
225
229
dataExtractorFactory -> {
226
230
assertThat (dataExtractorFactory , instanceOf (RollupDataExtractorFactory .class ));
227
- assertWarnings ("[interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future." );
228
231
},
229
232
e -> fail ()
230
233
);
@@ -245,13 +248,16 @@ public void testCreateDataExtractorFactoryGivenRollupAndRemoteIndex() {
245
248
MaxAggregationBuilder myField = AggregationBuilders .max ("myField" ).field ("myField" );
246
249
TermsAggregationBuilder myTerm = AggregationBuilders .terms ("termAgg" ).field ("termField" ).subAggregation (myField );
247
250
datafeedConfig .setParsedAggregations (AggregatorFactories .builder ().addAggregator (
248
- AggregationBuilders .dateHistogram ("time" ).interval (600_000 ).subAggregation (maxTime ).subAggregation (myTerm ).field ("time" )));
251
+ AggregationBuilders .dateHistogram ("time" )
252
+ .fixedInterval (new DateHistogramInterval ("600000ms" ))
253
+ .subAggregation (maxTime )
254
+ .subAggregation (myTerm )
255
+ .field ("time" )));
249
256
250
257
// Test with remote index, aggregation, and no chunking
251
258
ActionListener <DataExtractorFactory > listener = ActionListener .wrap (
252
259
dataExtractorFactory -> {
253
260
assertThat (dataExtractorFactory , instanceOf (AggregationDataExtractorFactory .class ));
254
- assertWarnings ("[interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future." );
255
261
},
256
262
e -> fail ()
257
263
);
@@ -302,11 +308,14 @@ public void testCreateDataExtractorFactoryGivenRollupAndValidAggregationAndAutoC
302
308
MaxAggregationBuilder myField = AggregationBuilders .max ("myField" ).field ("myField" );
303
309
TermsAggregationBuilder myTerm = AggregationBuilders .terms ("termAgg" ).field ("termField" ).subAggregation (myField );
304
310
datafeedConfig .setParsedAggregations (AggregatorFactories .builder ().addAggregator (
305
- AggregationBuilders .dateHistogram ("time" ).interval (600_000 ).subAggregation (maxTime ).subAggregation (myTerm ).field ("time" )));
311
+ AggregationBuilders .dateHistogram ("time" )
312
+ .fixedInterval (new DateHistogramInterval ("600000ms" ))
313
+ .subAggregation (maxTime )
314
+ .subAggregation (myTerm )
315
+ .field ("time" )));
306
316
ActionListener <DataExtractorFactory > listener = ActionListener .wrap (
307
317
dataExtractorFactory -> {
308
318
assertThat (dataExtractorFactory , instanceOf (ChunkedDataExtractorFactory .class ));
309
- assertWarnings ("[interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future." );
310
319
},
311
320
e -> fail ()
312
321
);
@@ -347,15 +356,18 @@ public void testCreateDataExtractorFactoryGivenRollupWithBadInterval() {
347
356
MaxAggregationBuilder myField = AggregationBuilders .max ("myField" ).field ("myField" );
348
357
TermsAggregationBuilder myTerm = AggregationBuilders .terms ("termAgg" ).field ("termField" ).subAggregation (myField );
349
358
datafeedConfig .setParsedAggregations (AggregatorFactories .builder ().addAggregator (
350
- AggregationBuilders .dateHistogram ("time" ).interval (600_000 ).subAggregation (maxTime ).subAggregation (myTerm ).field ("time" )));
359
+ AggregationBuilders .dateHistogram ("time" )
360
+ .fixedInterval (new DateHistogramInterval ("600000ms" ))
361
+ .subAggregation (maxTime )
362
+ .subAggregation (myTerm )
363
+ .field ("time" )));
351
364
ActionListener <DataExtractorFactory > listener = ActionListener .wrap (
352
365
dataExtractorFactory -> fail (),
353
366
e -> {
354
367
assertThat (e .getMessage (),
355
368
containsString ("Rollup capabilities do not have a [date_histogram] aggregation with an interval " +
356
369
"that is a multiple of the datafeed's interval." ));
357
370
assertThat (e , instanceOf (IllegalArgumentException .class ));
358
- assertWarnings ("[interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future." );
359
371
}
360
372
);
361
373
DataExtractorFactory .create (
@@ -374,14 +386,17 @@ public void testCreateDataExtractorFactoryGivenRollupMissingTerms() {
374
386
MaxAggregationBuilder myField = AggregationBuilders .max ("myField" ).field ("myField" );
375
387
TermsAggregationBuilder myTerm = AggregationBuilders .terms ("termAgg" ).field ("termField" ).subAggregation (myField );
376
388
datafeedConfig .setParsedAggregations (AggregatorFactories .builder ().addAggregator (
377
- AggregationBuilders .dateHistogram ("time" ).interval (600_000 ).subAggregation (maxTime ).subAggregation (myTerm ).field ("time" )));
389
+ AggregationBuilders .dateHistogram ("time" )
390
+ .fixedInterval (new DateHistogramInterval ("600000ms" ))
391
+ .subAggregation (maxTime )
392
+ .subAggregation (myTerm )
393
+ .field ("time" )));
378
394
ActionListener <DataExtractorFactory > listener = ActionListener .wrap (
379
395
dataExtractorFactory -> fail (),
380
396
e -> {
381
397
assertThat (e .getMessage (),
382
398
containsString ("Rollup capabilities do not support all the datafeed aggregations at the desired interval." ));
383
399
assertThat (e , instanceOf (IllegalArgumentException .class ));
384
- assertWarnings ("[interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future." );
385
400
}
386
401
);
387
402
DataExtractorFactory .create (
@@ -400,14 +415,17 @@ public void testCreateDataExtractorFactoryGivenRollupMissingMetric() {
400
415
MaxAggregationBuilder myField = AggregationBuilders .max ("myField" ).field ("otherField" );
401
416
TermsAggregationBuilder myTerm = AggregationBuilders .terms ("termAgg" ).field ("termField" ).subAggregation (myField );
402
417
datafeedConfig .setParsedAggregations (AggregatorFactories .builder ().addAggregator (
403
- AggregationBuilders .dateHistogram ("time" ).interval (600_000 ).subAggregation (maxTime ).subAggregation (myTerm ).field ("time" )));
418
+ AggregationBuilders .dateHistogram ("time" )
419
+ .fixedInterval (new DateHistogramInterval ("600000ms" ))
420
+ .subAggregation (maxTime )
421
+ .subAggregation (myTerm )
422
+ .field ("time" )));
404
423
ActionListener <DataExtractorFactory > listener = ActionListener .wrap (
405
424
dataExtractorFactory -> fail (),
406
425
e -> {
407
426
assertThat (e .getMessage (),
408
427
containsString ("Rollup capabilities do not support all the datafeed aggregations at the desired interval." ));
409
428
assertThat (e , instanceOf (IllegalArgumentException .class ));
410
- assertWarnings ("[interval] on [date_histogram] is deprecated, use [fixed_interval] or [calendar_interval] in the future." );
411
429
}
412
430
);
413
431
DataExtractorFactory .create (
@@ -427,7 +445,9 @@ private void givenAggregatableRollup(String field, String type, int minuteInterv
427
445
"*/30 * * * * ?" ,
428
446
300 ,
429
447
new GroupConfig (
430
- new DateHistogramGroupConfig ("time" , DateHistogramInterval .minutes (minuteInterval )), null , termsGroupConfig ),
448
+ new DateHistogramGroupConfig .FixedInterval ("time" , DateHistogramInterval .minutes (minuteInterval )),
449
+ null ,
450
+ termsGroupConfig ),
431
451
metricConfigs ,
432
452
null );
433
453
RollupJobCaps rollupJobCaps = new RollupJobCaps (rollupJobConfig );
0 commit comments