Class BucketsAggregator

    • Constructor Detail

      • BucketsAggregator

        public BucketsAggregator​(java.lang.String name,
                                 AggregatorFactories factories,
                                 SearchContext context,
                                 Aggregator parent,
                                 java.util.List<PipelineAggregator> pipelineAggregators,
                                 java.util.Map<java.lang.String,​java.lang.Object> metaData)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • maxBucketOrd

        public final long maxBucketOrd()
        Return an upper bound of the maximum bucket ordinal seen so far.
      • grow

        public final void grow​(long maxBucketOrd)
        Ensure there are at least maxBucketOrd buckets available.
      • collectBucket

        public final void collectBucket​(LeafBucketCollector subCollector,
                                        int doc,
                                        long bucketOrd)
                                 throws java.io.IOException
        Utility method to collect the given doc in the given bucket (identified by the bucket ordinal)
        Throws:
        java.io.IOException
      • mergeBuckets

        public final void mergeBuckets​(long[] mergeMap,
                                       long newNumBuckets)
      • getDocCounts

        public IntArray getDocCounts()
      • incrementBucketDocCount

        public final void incrementBucketDocCount​(long bucketOrd,
                                                  int inc)
        Utility method to increment the doc counts of the given bucket (identified by the bucket ordinal)
      • bucketDocCount

        public final int bucketDocCount​(long bucketOrd)
        Utility method to return the number of documents that fell in the given bucket (identified by the bucket ordinal)
      • consumeBucketsAndMaybeBreak

        protected final void consumeBucketsAndMaybeBreak​(int count)
        Adds count buckets to the global count for the request and fails if this number is greater than the maximum number of buckets allowed in a response
      • bucketAggregations

        protected final InternalAggregations bucketAggregations​(long bucket)
                                                         throws java.io.IOException
        Required method to build the child aggregations of the given bucket (identified by the bucket ordinal).
        Throws:
        java.io.IOException
      • bucketEmptyAggregations

        protected final InternalAggregations bucketEmptyAggregations()
        Utility method to build empty aggregations of the sub aggregators.
      • close

        public final void close()
        Description copied from class: AggregatorBase
        Called upon release of the aggregator.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface Releasable
        Overrides:
        close in class AggregatorBase