Get all results in aggregations

So when using an aggregation on a field, it returns only the result of that field and the doc count of each. Could we show for each result, all the docs corresponding to it?

Example :
An aggregation term on an id, gets all the results grouped by id, I would like to get for each group, all the documents having their same rows combined. If there's for example a field number, then for each grouped same ids, the row number gets summed.

Elasticsearch doesn't "collapse" aggregation results. If you want to find the counts for aggs that all share the same set of fields, you'll need to construct a heirarchy of aggregations to represent that.

E.g. a terms -> terms -> histogram -> sum, or whatever is needed to express the set of fields

A related topic is field collapsing, but this only applies to search hits, not aggregation results.

1 Like

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