-
Notifications
You must be signed in to change notification settings - Fork 195
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
Composite Aggregation after key ignored #785
Comments
composite aggregation is the only way to paginate aggregations. This is a major bug, |
@assafcoh Nobody has picked this up yet, care to help? Maybe start by adding a (failing) test? |
Unfortunately, i am not able to contribute here. However, this bug means there is no way to paginate aggregations with this java client. In my opinion, this is a central feature and should be given higher priority. |
@dblock Has there been any movement on this? This is a core feature that is really needed. |
@amcgreevy-r7 Would love your help, see above. |
hi guys, I am really surprised this bug is still lurking in the code. |
So, there's a couple things going on here: Separately a quirk of the client is that |
@Xtansia thank you for your reply. I decided to give this another try with the new java opensearch client version 2.19.0.
Apparently, when populating these double-quoted-values into CompositeAggregation.after(), they are ignored, and the search response contained the same initial afterkey every time. To fix this, whilst paginating the composite aggregation, i had to remove all the redundant double quotes (see code snippet below)
So the good news is that paginating composite aggregation works. But as you mentioned, to prevent such misunderstandings, the CompositeAggregation.after() should be changed to accept a Map<String, JsonData> to match CompositeAggregate.afterKey() |
If you could create a complete minimal code reproduction (ie. client setup, create index, ingest data, perform aggregate search) of this that would be ideal, as it may be a bug in OpenSearch itself or may be an oddity of the JsonData implementation. |
I fixed typo in my previous comment. Only the values returned from CompositeAggregate.afterKey() are enclosed in redundant double quotes |
What is the bug?
when searching with composite aggregation the supplied afterKey is ignored and we always get back the same initial afterKey.
Therefore, iterating with composite aggregation until the afterKey is null, leads to an infinite loop
client version
we encountered this bug with client version 2.6.0, 2.70 and also after upgrading to the latest 2.8.1 client version
How can one reproduce the bug?
search with composite aggregation in a loop until the afterKey is null.
Since the afterKey is ignored, it will always search from the beginning and repeatedly return the same afterKey
What is the expected behavior?
the afterKey should should be considered, so that after each search we get back the "next" afterKey
workaround
Unfortunately we switched back to the rest client :(
Code sample to reproduce infinite loop
The text was updated successfully, but these errors were encountered: