|
@@ -67,7 +67,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
"2017-12-12T22:55:46");
|
|
|
|
|
|
public void testMatchNoDocsDeprecatedInterval() throws IOException {
|
|
|
- testBothCases(new MatchNoDocsQuery(), DATASET,
|
|
|
+ testSearchCase(new MatchNoDocsQuery(), DATASET,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
histogram -> {
|
|
|
assertEquals(0, histogram.getBuckets().size());
|
|
@@ -78,11 +78,11 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testMatchNoDocs() throws IOException {
|
|
|
- testBothCases(new MatchNoDocsQuery(), DATASET,
|
|
|
+ testSearchCase(new MatchNoDocsQuery(), DATASET,
|
|
|
aggregation -> aggregation.calendarInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
- testBothCases(new MatchNoDocsQuery(), DATASET,
|
|
|
+ testSearchCase(new MatchNoDocsQuery(), DATASET,
|
|
|
aggregation -> aggregation.fixedInterval(new DateHistogramInterval("365d")).field(AGGREGABLE_DATE),
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
@@ -92,20 +92,13 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
Query query = new MatchAllDocsQuery();
|
|
|
|
|
|
testSearchCase(query, DATASET,
|
|
|
- aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
- histogram -> {
|
|
|
- assertEquals(6, histogram.getBuckets().size());
|
|
|
- assertTrue(AggregationInspectionHelper.hasValue(histogram));
|
|
|
- }, false
|
|
|
- );
|
|
|
- testSearchAndReduceCase(query, DATASET,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
histogram -> {
|
|
|
assertEquals(8, histogram.getBuckets().size());
|
|
|
assertTrue(AggregationInspectionHelper.hasValue(histogram));
|
|
|
}, false
|
|
|
);
|
|
|
- testBothCases(query, DATASET,
|
|
|
+ testSearchCase(query, DATASET,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE).minDocCount(1L),
|
|
|
histogram -> {
|
|
|
assertEquals(6, histogram.getBuckets().size());
|
|
@@ -122,34 +115,26 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
for (int i = 0; i < 1000; i++) {
|
|
|
foo.add(DATASET.get(randomIntBetween(0, DATASET.size()-1)));
|
|
|
}
|
|
|
- testSearchAndReduceCase(query, foo,
|
|
|
+ testSearchCase(query, foo,
|
|
|
aggregation -> aggregation.fixedInterval(new DateHistogramInterval("365d"))
|
|
|
.field(AGGREGABLE_DATE).order(BucketOrder.count(false)),
|
|
|
histogram -> assertEquals(8, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
|
|
|
testSearchCase(query, DATASET,
|
|
|
- aggregation -> aggregation.calendarInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
- histogram -> assertEquals(6, histogram.getBuckets().size()), false
|
|
|
- );
|
|
|
- testSearchAndReduceCase(query, DATASET,
|
|
|
aggregation -> aggregation.calendarInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
histogram -> assertEquals(8, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
- testBothCases(query, DATASET,
|
|
|
+ testSearchCase(query, DATASET,
|
|
|
aggregation -> aggregation.calendarInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE).minDocCount(1L),
|
|
|
histogram -> assertEquals(6, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
|
|
|
testSearchCase(query, DATASET,
|
|
|
- aggregation -> aggregation.fixedInterval(new DateHistogramInterval("365d")).field(AGGREGABLE_DATE),
|
|
|
- histogram -> assertEquals(6, histogram.getBuckets().size()), false
|
|
|
- );
|
|
|
- testSearchAndReduceCase(query, DATASET,
|
|
|
aggregation -> aggregation.fixedInterval(new DateHistogramInterval("365d")).field(AGGREGABLE_DATE),
|
|
|
histogram -> assertEquals(8, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
- testBothCases(query, DATASET,
|
|
|
+ testSearchCase(query, DATASET,
|
|
|
aggregation -> aggregation.fixedInterval(new DateHistogramInterval("365d")).field(AGGREGABLE_DATE).minDocCount(1L),
|
|
|
histogram -> assertEquals(6, histogram.getBuckets().size()), false
|
|
|
);
|
|
@@ -206,7 +191,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
assertEquals(0, histogram.getBuckets().size());
|
|
|
assertFalse(AggregationInspectionHelper.hasValue(histogram));
|
|
|
}, false);
|
|
|
- testSearchAndReduceCase(query, dates, aggregation, histogram -> {
|
|
|
+ testSearchCase(query, dates, aggregation, histogram -> {
|
|
|
assertEquals(0, histogram.getBuckets().size());
|
|
|
assertFalse(AggregationInspectionHelper.hasValue(histogram));
|
|
|
}, false);
|
|
@@ -221,7 +206,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
testSearchCase(query, dates, aggregation,
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
- testSearchAndReduceCase(query, dates, aggregation,
|
|
|
+ testSearchCase(query, dates, aggregation,
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
|
|
@@ -230,13 +215,13 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
testSearchCase(query, dates, aggregation,
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
- testSearchAndReduceCase(query, dates, aggregation,
|
|
|
+ testSearchCase(query, dates, aggregation,
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
}
|
|
|
|
|
|
public void testAggregateWrongFieldDeprecated() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(), DATASET,
|
|
|
+ testSearchCase(new MatchAllDocsQuery(), DATASET,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.YEAR).field("wrong_field"),
|
|
|
histogram -> {
|
|
|
assertEquals(0, histogram.getBuckets().size());
|
|
@@ -247,18 +232,18 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testAggregateWrongField() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(), DATASET,
|
|
|
+ testSearchCase(new MatchAllDocsQuery(), DATASET,
|
|
|
aggregation -> aggregation.calendarInterval(DateHistogramInterval.YEAR).field("wrong_field"),
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
- testBothCases(new MatchAllDocsQuery(), DATASET,
|
|
|
+ testSearchCase(new MatchAllDocsQuery(), DATASET,
|
|
|
aggregation -> aggregation.fixedInterval(new DateHistogramInterval("365d")).field("wrong_field"),
|
|
|
histogram -> assertEquals(0, histogram.getBuckets().size()), false
|
|
|
);
|
|
|
}
|
|
|
|
|
|
public void testIntervalYearDeprecated() throws IOException {
|
|
|
- testBothCases(LongPoint.newRangeQuery(SEARCHABLE_DATE, asLong("2015-01-01"), asLong("2017-12-31")), DATASET,
|
|
|
+ testSearchCase(LongPoint.newRangeQuery(SEARCHABLE_DATE, asLong("2015-01-01"), asLong("2017-12-31")), DATASET,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
histogram -> {
|
|
|
List<? extends Histogram.Bucket> buckets = histogram.getBuckets();
|
|
@@ -281,7 +266,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalYear() throws IOException {
|
|
|
- testBothCases(LongPoint.newRangeQuery(SEARCHABLE_DATE, asLong("2015-01-01"), asLong("2017-12-31")), DATASET,
|
|
|
+ testSearchCase(LongPoint.newRangeQuery(SEARCHABLE_DATE, asLong("2015-01-01"), asLong("2017-12-31")), DATASET,
|
|
|
aggregation -> aggregation.calendarInterval(DateHistogramInterval.YEAR).field(AGGREGABLE_DATE),
|
|
|
histogram -> {
|
|
|
List<? extends Histogram.Bucket> buckets = histogram.getBuckets();
|
|
@@ -303,7 +288,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalMonthDeprecated() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList("2017-01-01", "2017-02-02", "2017-02-03", "2017-03-04", "2017-03-05", "2017-03-06"),
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.MONTH).field(AGGREGABLE_DATE),
|
|
|
histogram -> {
|
|
@@ -327,7 +312,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalMonth() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList("2017-01-01", "2017-02-02", "2017-02-03", "2017-03-04", "2017-03-05", "2017-03-06"),
|
|
|
aggregation -> aggregation.calendarInterval(DateHistogramInterval.MONTH).field(AGGREGABLE_DATE),
|
|
|
histogram -> {
|
|
@@ -350,7 +335,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalDayDeprecated() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01",
|
|
|
"2017-02-02",
|
|
@@ -386,7 +371,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalDay() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01",
|
|
|
"2017-02-02",
|
|
@@ -418,7 +403,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
assertEquals(1, bucket.getDocCount());
|
|
|
}, false
|
|
|
);
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01",
|
|
|
"2017-02-02",
|
|
@@ -453,7 +438,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalHourDeprecated() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T09:02:00.000Z",
|
|
|
"2017-02-01T09:35:00.000Z",
|
|
@@ -500,7 +485,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalHour() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T09:02:00.000Z",
|
|
|
"2017-02-01T09:35:00.000Z",
|
|
@@ -543,7 +528,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
assertEquals(3, bucket.getDocCount());
|
|
|
}, false
|
|
|
);
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T09:02:00.000Z",
|
|
|
"2017-02-01T09:35:00.000Z",
|
|
@@ -589,7 +574,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalMinuteDeprecated() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T09:02:35.000Z",
|
|
|
"2017-02-01T09:02:59.000Z",
|
|
@@ -619,7 +604,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalMinute() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T09:02:35.000Z",
|
|
|
"2017-02-01T09:02:59.000Z",
|
|
@@ -645,7 +630,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
assertEquals(2, bucket.getDocCount());
|
|
|
}, false
|
|
|
);
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T09:02:35.000Z",
|
|
|
"2017-02-01T09:02:59.000Z",
|
|
@@ -674,7 +659,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalSecondDeprecated() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T00:00:05.015Z",
|
|
|
"2017-02-01T00:00:11.299Z",
|
|
@@ -705,7 +690,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testIntervalSecond() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T00:00:05.015Z",
|
|
|
"2017-02-01T00:00:11.299Z",
|
|
@@ -732,7 +717,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
assertEquals(3, bucket.getDocCount());
|
|
|
}, false
|
|
|
);
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T00:00:05.015Z",
|
|
|
"2017-02-01T00:00:11.299Z",
|
|
@@ -762,7 +747,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
}
|
|
|
|
|
|
public void testNanosIntervalSecond() throws IOException {
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T00:00:05.015298384Z",
|
|
|
"2017-02-01T00:00:11.299954583Z",
|
|
@@ -789,7 +774,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
assertEquals(3, bucket.getDocCount());
|
|
|
}, true
|
|
|
);
|
|
|
- testBothCases(new MatchAllDocsQuery(),
|
|
|
+ testSearchCase(new MatchAllDocsQuery(),
|
|
|
Arrays.asList(
|
|
|
"2017-02-01T00:00:05.015298384Z",
|
|
|
"2017-02-01T00:00:11.299954583Z",
|
|
@@ -829,7 +814,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
);
|
|
|
|
|
|
// 5 sec interval with minDocCount = 0
|
|
|
- testSearchAndReduceCase(query, timestamps,
|
|
|
+ testSearchCase(query, timestamps,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.seconds(5)).field(AGGREGABLE_DATE).minDocCount(0L),
|
|
|
histogram -> {
|
|
|
List<? extends Histogram.Bucket> buckets = histogram.getBuckets();
|
|
@@ -854,7 +839,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
);
|
|
|
|
|
|
// 5 sec interval with minDocCount = 3
|
|
|
- testSearchAndReduceCase(query, timestamps,
|
|
|
+ testSearchCase(query, timestamps,
|
|
|
aggregation -> aggregation.dateHistogramInterval(DateHistogramInterval.seconds(5)).field(AGGREGABLE_DATE).minDocCount(3L),
|
|
|
histogram -> {
|
|
|
List<? extends Histogram.Bucket> buckets = histogram.getBuckets();
|
|
@@ -879,7 +864,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
);
|
|
|
|
|
|
// 5 sec interval with minDocCount = 0
|
|
|
- testSearchAndReduceCase(query, timestamps,
|
|
|
+ testSearchCase(query, timestamps,
|
|
|
aggregation -> aggregation.fixedInterval(DateHistogramInterval.seconds(5)).field(AGGREGABLE_DATE).minDocCount(0L),
|
|
|
histogram -> {
|
|
|
List<? extends Histogram.Bucket> buckets = histogram.getBuckets();
|
|
@@ -904,7 +889,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
);
|
|
|
|
|
|
// 5 sec interval with minDocCount = 3
|
|
|
- testSearchAndReduceCase(query, timestamps,
|
|
|
+ testSearchCase(query, timestamps,
|
|
|
aggregation -> aggregation.fixedInterval(DateHistogramInterval.seconds(5)).field(AGGREGABLE_DATE).minDocCount(3L),
|
|
|
histogram -> {
|
|
|
List<? extends Histogram.Bucket> buckets = histogram.getBuckets();
|
|
@@ -1175,43 +1160,6 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
Consumer<DateHistogramAggregationBuilder> configure,
|
|
|
Consumer<InternalDateHistogram> verify,
|
|
|
int maxBucket, boolean useNanosecondResolution) throws IOException {
|
|
|
- executeTestCase(false, query, dataset, configure, verify, maxBucket, useNanosecondResolution);
|
|
|
- }
|
|
|
-
|
|
|
- private void testSearchAndReduceCase(Query query, List<String> dataset,
|
|
|
- Consumer<DateHistogramAggregationBuilder> configure,
|
|
|
- Consumer<InternalDateHistogram> verify, boolean useNanosecondResolution) throws IOException {
|
|
|
- testSearchAndReduceCase(query, dataset, configure, verify, 1000, useNanosecondResolution);
|
|
|
- }
|
|
|
-
|
|
|
- private void testSearchAndReduceCase(Query query, List<String> dataset,
|
|
|
- Consumer<DateHistogramAggregationBuilder> configure,
|
|
|
- Consumer<InternalDateHistogram> verify,
|
|
|
- int maxBucket, boolean useNanosecondResolution) throws IOException {
|
|
|
- executeTestCase(true, query, dataset, configure, verify, maxBucket, useNanosecondResolution);
|
|
|
- }
|
|
|
-
|
|
|
- private void testBothCases(Query query, List<String> dataset,
|
|
|
- Consumer<DateHistogramAggregationBuilder> configure,
|
|
|
- Consumer<InternalDateHistogram> verify, boolean useNanosecondResolution) throws IOException {
|
|
|
- testBothCases(query, dataset, configure, verify, 10000, useNanosecondResolution);
|
|
|
- }
|
|
|
-
|
|
|
- private void testBothCases(Query query, List<String> dataset,
|
|
|
- Consumer<DateHistogramAggregationBuilder> configure,
|
|
|
- Consumer<InternalDateHistogram> verify,
|
|
|
- int maxBucket, boolean useNanosecondResolution) throws IOException {
|
|
|
- testSearchCase(query, dataset, configure, verify, maxBucket, useNanosecondResolution);
|
|
|
- testSearchAndReduceCase(query, dataset, configure, verify, maxBucket, useNanosecondResolution);
|
|
|
- }
|
|
|
-
|
|
|
- private void executeTestCase(boolean reduced,
|
|
|
- Query query,
|
|
|
- List<String> dataset,
|
|
|
- Consumer<DateHistogramAggregationBuilder> configure,
|
|
|
- Consumer<InternalDateHistogram> verify,
|
|
|
- int maxBucket, boolean useNanosecondResolution) throws IOException {
|
|
|
-
|
|
|
boolean aggregableDateIsSearchable = randomBoolean();
|
|
|
DateFieldMapper.DateFieldType fieldType = aggregableDateFieldType(useNanosecondResolution, aggregableDateIsSearchable);
|
|
|
|
|
@@ -1220,10 +1168,6 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
try (RandomIndexWriter indexWriter = new RandomIndexWriter(random(), directory)) {
|
|
|
Document document = new Document();
|
|
|
for (String date : dataset) {
|
|
|
- if (frequently()) {
|
|
|
- indexWriter.commit();
|
|
|
- }
|
|
|
-
|
|
|
long instant = asLong(date, fieldType);
|
|
|
document.add(new SortedNumericDocValuesField(AGGREGABLE_DATE, instant));
|
|
|
if (aggregableDateIsSearchable) {
|
|
@@ -1243,12 +1187,7 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
|
|
|
configure.accept(aggregationBuilder);
|
|
|
}
|
|
|
|
|
|
- InternalDateHistogram histogram;
|
|
|
- if (reduced) {
|
|
|
- histogram = searchAndReduce(indexSearcher, query, aggregationBuilder, maxBucket, null, fieldType);
|
|
|
- } else {
|
|
|
- histogram = search(indexSearcher, query, aggregationBuilder, maxBucket, fieldType);
|
|
|
- }
|
|
|
+ InternalDateHistogram histogram = searchAndReduce(indexSearcher, query, aggregationBuilder, maxBucket, fieldType);
|
|
|
verify.accept(histogram);
|
|
|
}
|
|
|
}
|