Skip to content
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

Closed
jpountz opened this issue Jul 18, 2014 · 5 comments
Closed

Aggregations: Make order more flexible for terms #6917

jpountz opened this issue Jul 18, 2014 · 5 comments

Comments

@jpountz
Copy link
Contributor

jpountz commented Jul 18, 2014

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.

@rmuir
Copy link
Contributor

rmuir commented Jul 25, 2014

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?

@Tiduin
Copy link

Tiduin commented Aug 20, 2014

In a first step it would be great to combine a sub-aggregation with the always given _count aggregation.
E.g.: I want to boost my best eCommerce categories, but if the "boost" is equal, sort by the count of matching products.

@brusic
Copy link
Contributor

brusic commented Aug 20, 2014

@maik2102, sounds like you want secondary sorting, which is a feature I would like as well.

colings86 added a commit that referenced this issue Sep 8, 2014
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
colings86 added a commit that referenced this issue Sep 15, 2014
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
Replaces #7588
@hsm3
Copy link

hsm3 commented Feb 16, 2015

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.

@colings86
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants