Currently if I am not wrong scripts are run on each document. Can it be
done at Facet level. For example:
I have terms A and B which are part of an Index. Now I need an additional
term C = A * B and then I do aggregation on all 3 terms.
For term C I use statisticalScriptFacet and for rest I use *
But looks like the script executes at each document level so it becomes
equivalent to Sum (A1 * B1 + A2 * B2 + A3 * B3 + .........+ An * Bn)
Whereas I need ---- Sum (A) * Sum (B)
Is there any easy way of achieving it without handling at the client level?