Group By and Order By in Templating variable query


The below query gives me 10 student names in class 9
{“find”: “terms”, “field”: “student_name”, “size”:10,“query”:“class:9”}

But i want the top 10 student names in class 9, order by their sum of marks in all subjects.
Can this be possible??? my data source is elastic search.

Thanks in Advance…

Unfortunately, I don’t think this is possible. There is no sort option for ES template variables.