Closed marko-bekhta closed 1 month ago
Haven't tried to reproduce yet, but most likely due to #13865
@bowenlan-amzn can you take a look?
Thanks for taking a look. Yeah, I was looking at the change log, and the https://github.com/opensearch-project/OpenSearch/pull/13865 also caught my eye.
By the way, a question not entirely related to the issue at hand: do you happen to have a snapshot build of OpenSearch that we could run tests against? Ideally, it would be a snapshot docker image, so it'll be easier to integrate the testing into our CI. That'd help catch this kind of issues before the release..
I could repro this, in both cases we get
"aggregations": {
"aggregationName": {
"buckets": {
"0": {
"to": 0.0,
"doc_count": 3
},
"1": {
"from": 0.0,
"doc_count": 0
}
}
}
}
As for the snapshots, I know we have them here -- https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/opensearch/
I can also verify that this is happening when using a date_range
aggregation. All filters of the query are ignored when it is used in 2.16.0.
@marko-bekhta @dennisoelkers sorry for the late reply. Please try set this cluster setting search.max_aggregation_rewrite_filters
to 0 to disable this filter rewrite optimization, it should fall back to the default aggregation path.
@dennisoelkers can we confirm if disabling the dynamic setting search.max_aggregation_rewrite_filters
helps with mitigating the issue here?
@getsaurabh02 I've just tested and it does appear to properly return 0:
Compare (first item is more recent, after applying search.max_aggregation_rewrite_filters: 0
. Second item is before setting search.max_aggregation_rewrite_filters
)
I'll defer to Dennis for his expertise though.
So far we've gotten 2 (3 counting my test above) positive acknowledgments that the workaround does resolve the issue. 🙌
This is great news.
Maybe someone on this thread could add some agg examples to https://github.com/opensearch-project/opensearch-api-specification/tree/main/tests and make sure we have those specs? We have lots of users asking for agg support in clients (example)
@getsaurabh02: I can verify that it the setting is fixing for us now, results are as expected again, at least for the cases that I tested (using a date_range
aggregation).
Describe the bug
Range aggregation ignores query. This is working ok in 2.15.0 and started to fail in the recent 2.16.0.
Related component
Search:Aggregations
To Reproduce
This problem was initially noticed with a routing filter, but it can also be reproduced with other queries, e.g., a range query.
{ "mappings": { "dynamic": "strict", "properties": { "Integer": { "type": "integer" } } } }
3.1. Try to get a range aggregation and use the filter on a route:
3.2. Alternatively, try a simple
>
query instead:In both cases, the result is:
Expected behavior
It would be expected to get
in the case of 3.1: 2 documents in the bucket "0" as there are only two documents with the
route1
:in the case of 3.2: 0 doc counts in both ranges, since none of the values are > 0
Additional Details
Plugins
Host/Environment (please complete the following information):
Additional context Running OpenSearch using the official
opensearchproject/opensearch:2.16.0
image.