I have a metric (document) that contains three different fields: a, b, and c. The metric can be filtered by time and location.

I want to filter all the data points of this metric according to time and location (using Kibana map filter) and perform the following process:

- Calculate a few permutations for each data point, such as '2
*a + 2*b', '2*a + b + c'. - For each permutation, count how many times it is greater than X, i.e., in how many data points the permutation exceeds X.
- Display the permutations in an ordered manner based on the results from step 2.

I know how to accomplish steps 1 and 2 by creating a new field for each permutation. However, I'm unsure about how to present the results in a sorted manner, I can only show the result for each permutation separately.

Any help would be appreciated.