Last term agg bucket size

Hello, I have a following problem, hope somebody can help.
I have a total count (TC) of agents (hard limit = number of seats) and I need to display their statuses over time: AVAILABLE, BUSY, ON_BREAK and ABSENT. FIrst three statuses should be result of the term aggregation, but the ABSENT one should be TC - (size(AVAILABLE) +size (BUSY) + size (ON_BREAK)).

Would it be possible to cap the size of the ABSENT bucket to TC - (sum of other bucket sizes).
My client is grafana so I guess It has to be on the ES side, if it is possible at all.

Thanks,
Milan

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