-
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
Aggregations: Make order more flexible for terms #6917
Comments
its tricky for collation because there is not a 1-to-1 mapping of keys to original values. collation rules may collapse two terms into the same key, for example because the strength determines it should ignore case, so "Test" and "test" get the same key... so what should the aggregation do in such a case, what would be the output? |
In a first step it would be great to combine a sub-aggregation with the always given _count aggregation. |
@maik2102, sounds like you want secondary sorting, which is a feature I would like as well. |
The terms aggregation can now support sorting on multiple criteria by replacing the sort object with an array or sort object whose order signifies the priority of the sort. The existing syntax for sorting on a single criteria also still works. Contributes to #6917
We are also doing ecommerce, and have groups of products being returned via a terms agg. We would really like to use a secondary sort to improve the fine-grain ordering, and break ties to make the sort stable. |
We now have the ability to order by mutliple criteria. Ordering by collation is tricky as mentioned above and we already have issues with unbounded errors in terms ordering as mntioned in #17588. |
Terms aggregations only allow to sort based on the UTF-8 bytes of the term, its count or a sub-aggregation.
We should add more flexibility here to allow for doing things like having compound orders, sorting by collation or by a script that would apply to the sub aggregations.
The text was updated successfully, but these errors were encountered: