-
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
Possibility to add new ordering scheme for Aggregation results. #26570
Comments
From where this |
Lets say we have a bunch of alerts :-
Now i want to count the alerts bucket them on the day of week they arrive and would be pretty useful if I could order them based on the day of week. Like :- Monday, Tuesday, Wednesday, etc. And similarly many people would like to have their own ordering logic so having option to add such features via plugins might help.
This becomes more prominent when you want your Kibana visualizations to show up in a specific order and leads to issues like this :- On top of it- Elasticsearch being a search engine, it would be very helpful for search results to be ordered via custom logic as well because you certainly can't cater everyone. So why not give possibility to define custom ordering logic via a plugin? |
For now I think that the easiest solution would be to index the day of week as a number with Monday=0, Tuesday=1 etc.
For search results one can use Script Based Sorting. For aggregation results I think we can open a discussion on this. |
cc @elastic/es-search-aggs |
Chatted about this a bit in Fixit Thursday. This is something we'd like to support...somehow. Not entirely sure where it belongs at the moment.
Regardless of where it ends up, it feels like a gap in our features that you can't sort buckets with custom logic. I'm personally leaning towards extending the |
+1 for doing this in the |
Any update on this feature? |
No news @jainraj. If/when there is movement someone will update this ticket, or reference it from a PR. We would like to implement it by adding scripting to the The issue is marked |
I'd like to work on this. |
I don't think we're going to do anything with this in the short term. You totally can aggregate on a runtime field now and emit the day of the week - you could even do something like |
@nik9000 not all use cases can be solved using runtime fields and adding a feature to bucket_sort to be able to do script sorting would also be inline with the current [documentation] which references the sorting page |
When using "term" bucket aggregation, the data can be ordered by term in Ascending order or in descending order. There is no other option available. Like :- Ordering based on day of week.
This feature would also solve problems like #10543
Is it something which can be implemented via a Plugin? If so then how can I attach my Ordering logic?
The text was updated successfully, but these errors were encountered: