Class DeferableBucketAggregator

    • Constructor Detail

      • DeferableBucketAggregator

        protected DeferableBucketAggregator​(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

      • doPreCollection

        protected void doPreCollection()
                                throws java.io.IOException
        Description copied from class: AggregatorBase
        Can be overridden by aggregator implementation to be called back when the collection phase starts.
        Overrides:
        doPreCollection in class AggregatorBase
        Throws:
        java.io.IOException
      • descendsFromGlobalAggregator

        public static boolean descendsFromGlobalAggregator​(Aggregator parent)
      • shouldDefer

        protected boolean shouldDefer​(Aggregator aggregator)
        This method should be overridden by subclasses that want to defer calculation of a child aggregation until a first pass is complete and a set of buckets has been pruned. Deferring collection will require the recording of all doc/bucketIds from the first pass and then the sub class should call runDeferredCollections(long...) for the selected set of buckets that survive the pruning.
        Parameters:
        aggregator - the child aggregator
        Returns:
        true if the aggregator should be deferred until a first pass at collection has completed
      • runDeferredCollections

        protected final void runDeferredCollections​(long... bucketOrds)
                                             throws java.io.IOException
        Throws:
        java.io.IOException