Terms stats with precentage

Hi

I have an index with the following fields: id (int), num1 (int), num2
(int), div (double).
The field "div" is the division on num1/num2.
I want to get the aggregated division for each id. Using terms stats on
"div" field is not good since you can't add percentages.
The long way would be doing 2 terms stats - on num1 and on num2, and divide
the sums for each id.
Is there a way to do that with 1 terms stats? maybe using value script
somehow?

Thanks