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

Sorting terms agg by sub-aggegation doesn't respect asc/desc when executing on a single shard #4951

Closed
uboness opened this issue Jan 30, 2014 · 2 comments

Comments

@uboness
Copy link
Contributor

uboness commented Jan 30, 2014

As reported on #4643, when trying to sort terms aggregation based on sub metric aggregation, the asc/desc order is not respected. For example:

{
  "aggs": {
    "fieldValues": {
      "terms": {
        "field": "name.field",
        "order": {
          "totalAmount": "desc"
        }
      },
      "aggs": {
        "totalAmount": {
          "sum": {
            "field": "amount"
          }
        }
      }
    }
  },
  "size": 0
}

In the example above, when executing on a single shard, the terms are always sorted in an ascending order.

uboness added a commit that referenced this issue Jan 30, 2014
…agg based on sub metric agg, the order (asc/desc) is not respected

 - fixed tests for terms order

Closes #4951
uboness added a commit that referenced this issue Jan 30, 2014
…agg based on sub metric agg, the order (asc/desc) is not respected

 - fixed tests for terms order

Closes #4951
@uboness
Copy link
Contributor Author

uboness commented Jan 30, 2014

@benatwork99 fyi, thx for your patience

@benatwork99
Copy link

@uboness Thank you for the quick fix! Looking forward to RC2 :)

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…agg based on sub metric agg, the order (asc/desc) is not respected

 - fixed tests for terms order

Closes elastic#4951
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

3 participants