Perform significant terms aggregation in Elastic search based on sum of a field rather than count if documents

Suppose I have these three documents. I wish to apply significant terms on the token field. By default, significance would be calculated based on the count of foreground and background sets. E.g. For the term Annine, the count of docs in foreground is 1 out of 1 whereas in the background is also 1 out of 3.

<{
"token":"left",
"count":5
},
{
"token":"left",
"count":15
},
{
"token":"Annine",
"count":25
} >

However, I wish to calculate the significance based on the sum of the count. i.e. for Annine, foreground is 25 out of 25 whereas in background it is 25 out of 45. How can i implement this?

Hi Vaibhav,
We have an old open issue for this which includes some comments on a possible workaround using scripted metric aggregations.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.