-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Additional aggregation in search request is changing results #14000
Comments
A git bisect turned up this commit to be the first introducing the issue: 795d868 |
@jed326: Do you have an idea why that change produces these results? |
Thanks for reporting this @dennisoelkers. Are you seeing the issue with the filter aggregation only with concurrent segment search enabled or also with it disabled as well? |
@jed326: I am using default options. It looks like concurrent segment search is disabled by default? From querying "search": {
"concurrent_segment_search": {
"enabled": "false"
}, |
@dennisoelkers yes concurrent segment search is disabled by default. Could you quickly check if the same issue persists with concurrent search enabled? These are both very interesting:
At a glance it looks like there might be something going wrong with agg scripting (there's a known issue for composite aggs w/ scripting #12947). What's strange is the commit 795d868 ideally shouldn't affect the non-concurrent search path at all but perhaps that is not the case. Let me take a deeper look at this today. If you have any pointers on how to set up the backing data for reproduction that would help a lot (for example if you have a java integration test that is indexing all this data). |
@jed326: Will try with CSS enabled, just want to drop you some aid for setting up a reproducible scenario. For bisecting, I was using the fixtures from one of our tests. In order to ingest it into an instance running locally, I wrote this script. It is assuming that OS is running on port 9200, with no TLS and no authentication (I just used |
@jed326: Enabling CSS on the index and rerunning the query also returns results which are off. |
@dennisoelkers Thanks for checking and thanks for the reproduction aids. I will try to get to the bottom of this today! |
Just confirming I checked out the parent commit 42f00ba and don't see the problem with either concurrent search enabled.
Tried re-indexing and see slightly different results so it's probably segment layout dependent. |
@dennisoelkers I was able to get to the bottom of this today. In 618782d we added some logic to unwrap the OpenSearch/server/src/main/java/org/opensearch/search/aggregations/BucketCollectorProcessor.java Lines 73 to 84 in ba0df74
However there's a bug here where if a This manifests as a problem in the Lines 123 to 128 in ba0df74
To specifically address the "strange" points you shared above:
The issue at hand is not specific to the
The issue with the double counted last leaf is specific to when the deferring collector is used. By default the collect mode when a script is present is
|
Working on getting a PR out to address this bug, I think we should be able to get it into the 2.15 release. On 2.14 you can manually set the |
Describe the bug
We have discovered erratic behavior for aggregation results introduced in
v2.14.0
(double-checked againstv2.13.0
, results are okay there). We have the following query (the actual queries we are using make more sense, this is the minimal query we have found to trigger the issue):The underlying data in the index are test fixtures from out integration tests (check here) - format is that each document in
$.documents[*].document
has aindex
metadata object containing the index name/document id/document type anddata
containing the actual document.Starting with
v2.14.0
, the result looks like this:What is noteworthy is that for each of the buckets generated by the filter aggregations, the document count of the bucket that goes into the filter aggregation is half of the document count that comes out of the filter aggregation:
The initial document count (e.g.
860
for theGET
bucket) is correct, the one in the bucket produced by the filter aggregation is not. When adding e.g. asum
metric aggregation as a leaf, the value returned is double of what is expected, so it looks like for some reason the actual documents are duplicated during the aggregation.What is very strange is:
v2.14.0
timestamp-min
metric, the results are okay"script": {...}
with"field": "http_method"
, the results are okayRelated component
Search:Aggregations
To Reproduce
Expected behavior
Expecting a result like this:
Additional Details
Plugins
No plugins installed
Screenshots
-- Not applicable --
Host/Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: