-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
SQL: ORDER BY COUNT() throws error #32870
Comments
Pinging @elastic/es-search-aggs |
While this is a valid and probably frequently used type of functionality, in ES-SQL this is not possible (at the moment) due to how the composite aggregation (used behind the scene to perform the grouping and ordering) works: it can only order by the key (the value). I do have a concern, though, regarding the error message. More about this in this issue. |
ES v - 6.4.1 But still it doesn't return the query sorted in DESC order. If possible i would like to work on this new feature. |
Having the ability to order by a count would be very useful indeed. The following comment implies that this might be possible at some point in future (emphasis mine).
But this issue has a Does this mean there are no near-term plans to support this feature, but that it's not entirely ruled out? |
There's a separate issue (#35118) that tracks this feature which is currently being investigated. It's best to monitor that for progress. |
As FYI, this feature is now supported and merged into 7.x and upcoming 6.7. |
I am in need of this feature big time. Is there a patch that can be made available for 6.6? This is quite helpful for our Canvas implementation. Or any workaround in 6.6? |
Elasticsearch version (
v6.3.1
):Description of the problem including expected versus actual behavior:
I’m trying to list the counts of each city in descending order.
For example, if Paris occurred 100 times in the database, London occurred 25 times, and Sydney 3, then I would like the output to be listed with Paris first, then London, then Sydney.
However, the following SQL query throws an error:
Error
The text was updated successfully, but these errors were encountered: