Skip to content

Commit

Permalink
remove date histogram boolean support
Browse files Browse the repository at this point in the history
  • Loading branch information
not-napoleon committed Dec 11, 2024
1 parent 912d37a commit bbc27d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,49 +42,6 @@ public static void registerAggregators(ValuesSourceRegistry.Builder builder) {
);

builder.register(DateHistogramAggregationBuilder.REGISTRY_KEY, CoreValuesSourceType.RANGE, DateRangeHistogramAggregator::new, true);

builder.register(
DateHistogramAggregationBuilder.REGISTRY_KEY,
CoreValuesSourceType.BOOLEAN,
(
name,
factories,
rounding,
order,
keyed,
minDocCount,
downsampledResultsOffset,
extendedBounds,
hardBounds,
valuesSourceConfig,
context,
parent,
cardinality,
metadata) -> {
DEPRECATION_LOGGER.warn(
DeprecationCategory.AGGREGATIONS,
"date-histogram-boolean",
"Running DateHistogram aggregations on [boolean] fields is deprecated"
);
return DateHistogramAggregator.build(
name,
factories,
rounding,
order,
keyed,
minDocCount,
downsampledResultsOffset,
extendedBounds,
hardBounds,
valuesSourceConfig,
context,
parent,
cardinality,
metadata
);
},
true
);
}

private final DateHistogramAggregationSupplier aggregatorSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
"2017-12-12T22:55:46"
);

public void testBooleanFieldDeprecated() throws IOException {
public void testBooleanFieldUnsupported() throws IOException {
final String fieldName = "bogusBoolean";
testCase(iw -> {
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> testCase(iw -> {
Document d = new Document();
d.add(new SortedNumericDocValuesField(fieldName, 0));
iw.addDocument(d);
Expand All @@ -95,8 +95,8 @@ public void testBooleanFieldDeprecated() throws IOException {
new DateHistogramAggregationBuilder("name").calendarInterval(DateHistogramInterval.HOUR).field(fieldName),
new BooleanFieldMapper.BooleanFieldType(fieldName)
)
);
assertWarnings("Running DateHistogram aggregations on [boolean] fields is deprecated");
));
assertThat(e.getMessage(), equalTo("Field [bogusBoolean] of type [boolean] is not supported for aggregation [date_histogram]"));
}

public void testMatchNoDocs() throws IOException {
Expand Down

0 comments on commit bbc27d8

Please sign in to comment.