Global aggregations on nested documents

(Pierre Loan Janczak) #1


I was wondering if it is possible to have a global aggregation based on a nested property within a document.

I stumbled upon this in the elastic documentation :frowning:

"Global aggregators can only be placed as top level aggregators because it doesn’t make sense to embed a global aggregator within another bucket aggregator."

Does that mean that it is not possible ?


(Zachary Tong) #3

Can you give a bit more context of what you're trying to achieve? The global aggregation is just a way to "escape" the query context. E.g. a query may match a subset of the documents, which are then given to the aggregation for calculating metrics, etc.

The Global agg lets you run aggregations on all the documents, whether they matched the query or not.

(system) #4

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