-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Sorting a terms aggregation on a child top_metrics aggregation fails with a keyword field #78506
Comments
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Yup, this looks like a bug. It's definitely intended to work, and we reproduced it following your steps. I'm wrapping up some other work, but I'll take a look at this next and hopefully get a fix for you soon. Thanks for reporting it. |
Thx @not-napoleon We're starting to run some extensive testing trying to replace Keep up the great work! David |
Hey guys, Any news on this one? Cheers, |
Using a double as a return value works only if the field we are sorting on is a number. If the field is not a value we can convert to a double, like a non-numeric keyword, converting it to a number returns `NaN`. Without this patch, sorting takes place on the bucket key, if the order field points to a non-numeric value. The additional bucket key comparator is implicitly added as a tie breaker to avoid non-deterministic sorting of buckets. With this change we support sorting using any subclass of SortValue. This means the bucket key will be used just in case of equal values on the order field. Issue: elastic#78506
Using a double as a return value works only if the field we are sorting on is a number. If the field is not a value we can convert to a double, like a non-numeric keyword, converting it to a number returns `NaN`. Without this patch, sorting takes place on the bucket key, if the order field points to a non-numeric value. The additional bucket key comparator is implicitly added as a tie breaker to avoid non-deterministic sorting of buckets. With this change we support sorting using any subclass of SortValue. This means the bucket key will be used just in case of equal values on the order field. Issue: #78506
Elasticsearch version (
bin/elasticsearch --version
): 7.13.3Plugins installed: []
JVM version (
java -version
): Bundled JDKOS version (
uname -a
if on a Unix-like system): Linux 5.11.0-34-generic #36~20.04.1-Ubuntu SMP Fri Aug 27 08:06:32 UTC 2021 x86_64 x86_64 x86_64 GNU/LinuxDescription of the problem including expected versus actual behavior:
Sorting a
terms
aggregation on a childtop_metrics
aggregation does not work with akeyword
field. Sorting does not happen and theterms
aggregation is sorted by_key
as if there was noorder
defined. Sorting on a number metric works just fine.Steps to reproduce:
Kibana script to reproduce
Produces
But I was expecting my buckets to be ordered
[third, second, first]
Provide logs (if relevant): N/A
The text was updated successfully, but these errors were encountered: