Skip to content

Stop aggregations from trying to build sub-aggregations that have never seen the a bucket #79381

Open
@nik9000

Description

@nik9000

Right now aggregations like terms will blindly call buildAggregation for all buckets that might be collected whether or not there were any documents in that aggregation. That forces all sub-aggregations to add guards like

         if (valuesSources == null || bucket >= counts.size()) {

But the parent aggregations already know if they've sent any documents to the sub-aggregations for a particular bucket. And they could just call buildEmptyAggregation for buckets that have never seen any docs. That'd be so much kinder.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions