mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-09-12 21:58:58 -04:00
Bleve has count facets only: no metric and no nested facet. So far a metric or a sub-aggregation widened the page to every match and loaded all stored fields of each, then folded the hits in Go. The stored document, extracted text included, was decoded for every match: about 1s and 780MB per 100k matches, independent of the nesting depth. Metrics and nested aggregations now go through an aggCollector hooked into bleve's collector walk via the document-match-handler context key. For every match it visits the doc values of the aggregated fields, the columnar storage bleve's own facets read, and folds them into an accumulator tree. The page stays the size the caller asked for and no stored field is loaded for an aggregation: 7x faster and 80x less memory at 100k matches, within 1.4x of a native bleve facet. Flat terms and range aggregations stay bleve facets. A range parent now carries its sub-aggregations too (the hit fold matched range bucket names against raw values and never attached them), and multi-valued fields count each value like a bleve facet does. The parity suite renders nested results and pins them on both engines: terms in terms, metrics per bucket, terms in numeric and date ranges, three levels, a page of one still aggregating every match, and a malformed bound in a nested range.