mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-19 11:24:54 +00:00
The current idiom is to have the InternalAggregator find all the buckets sharing the same key, put them in a list, get the first bucket and ask that bucket to reduce all the buckets (including itself). This a somewhat confusing workflow, and feels like the aggregator should be reducing the buckets (since the aggregator owns the buckets), rather than asking one bucket to do all the reductions. This commit basically moves the `Bucket.reduce()` method to the InternalAgg and renames it `reduceBucket()`. It also moves the `createBucket()` (or equivalent) method from the bucket to the InternalAgg as well.