Skip to content

Commit

Permalink
revert changes after wrong merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczi committed Dec 18, 2024
1 parent fd66bd8 commit 84dcda0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 52 deletions.
14 changes: 14 additions & 0 deletions docs/changelog/118484.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pr: 118484
summary: Remove date histogram boolean support
area: Aggregations
type: breaking
issues: []
breaking:
title: Remove date histogram boolean support
area: Aggregations
details: Elasticsearch no longer allows running Date Histogram aggregations
over boolean fields. Instead, use Terms aggregation for boolean
fields.
impact: We expect the impact to be minimal, as this never produced good
results, and has been deprecated for years.
notable: false
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ normal priority deployments.
Controls how many inference requests are allowed in the queue at a time.
Every machine learning node in the cluster where the model can be allocated
has a queue of this size; when the number of requests exceeds the total value,
new requests are rejected with a 429 error. Defaults to 1024. Max allowed value
is 1000000.
new requests are rejected with a 429 error. Defaults to 10000. Max allowed value
is 100000.

`threads_per_allocation`::
(Optional, integer)
Expand Down Expand Up @@ -173,7 +173,7 @@ The API returns the following results:
"model_bytes": 265632637,
"threads_per_allocation" : 1,
"number_of_allocations" : 1,
"queue_capacity" : 1024,
"queue_capacity" : 10000,
"priority": "normal"
},
"routing_table": {
Expand Down Expand Up @@ -229,4 +229,4 @@ POST _ml/trained_models/my_model/deployment/_start?deployment_id=my_model_for_se
}
}
--------------------------------------------------
// TEST[skip:TBD]
// TEST[skip:TBD]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.Aggregator;
Expand Down Expand Up @@ -42,49 +41,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 84dcda0

Please sign in to comment.