How to sort elasticsearch with raw_data

Is it possible to sort elasticsearch result in grafana when using “raw_data” metrics?
For example, if I wanted to query slowest queries (mysql, postgresql …) I would like to get them sorted by execution time to populate a table widget, but I can’t figure how to do that.

NOTE: transform functions are not the solution seems they operate AFTER the datasource returns

Grafana version 9.3.2 (the docker image from dockerhub) and 8.3.6 (production one)

no answer? it seems to be a very simple usecase…

might this Transformation work for you?


Tx @yosiasz for your answer but, unfortunately it does not help.

As I explained : transformations happened AFTER retrieving results from elastic.
I need a way to pushback the sort to the elasticsearch query (not to sort the limited resultset)