aggregate

abstract fun aggregate(query: AdmittedQuery<AggregationQuery>, window: GroupWindow): Flux<ObjectNode>

Streams the groups of query in its effective sort order, at most GroupWindow.First.limit of them, or every group for GroupWindow.All. The core has already removed from query what it computes itself.

Without groups the result is one summary row over the matched records. The Backend may emit it always (as Elasticsearch does) or emit nothing when no record matched (as MongoDB $group does); the core emits the empty summary only when the Backend emits no row, so it never duplicates one.