How to sort elasticsearch with raw_data

Hello
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)