Class MergingBucketsDeferringCollector

  • All Implemented Interfaces:

    public class MergingBucketsDeferringCollector
    extends BestBucketsDeferringCollector
    A specialization of BestBucketsDeferringCollector that collects all matches and then is able to replay a given subset of buckets. Exposes mergeBuckets, which can be invoked by the aggregator when increasing the rounding interval.
    • Constructor Detail

      • MergingBucketsDeferringCollector

        public MergingBucketsDeferringCollector​(SearchContext context,
                                                boolean isGlobal)
    • Method Detail

      • mergeBuckets

        public void mergeBuckets​(long[] mergeMap)
        Merges/prunes the existing bucket ordinals and docDeltas according to the provided mergeMap. The mergeMap is an array where the index position represents the current bucket ordinal, and the value at that position represents the ordinal the bucket should be merged with. If the value is set to -1 it is removed entirely. For example, if the mergeMap [1,1,3,-1,3] is provided: - Buckets `0` and `1` will be merged to bucket ordinal `1` - Bucket `2` and `4` will be merged to ordinal `3` - Bucket `3` will be removed entirely This process rebuilds the ordinals and docDeltas according to the mergeMap, so it should not be called unless there are actually changes to be made, to avoid unnecessary work.