Class DeferableBucketAggregator
- java.lang.Object
-
- org.elasticsearch.search.aggregations.BucketCollector
-
- org.elasticsearch.search.aggregations.Aggregator
-
- org.elasticsearch.search.aggregations.AggregatorBase
-
- org.elasticsearch.search.aggregations.bucket.BucketsAggregator
-
- org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.lucene.search.Collector,Releasable
- Direct Known Subclasses:
SamplerAggregator,TermsAggregator
public abstract class DeferableBucketAggregator extends BucketsAggregator
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.Aggregator
Aggregator.Parser, Aggregator.SubAggCollectionMode
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.search.aggregations.AggregatorBase
collectableSubAggregators, context, DEFAULT_WEIGHT, name, parent, subAggregators
-
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDeferableBucketAggregator(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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleandescendsFromGlobalAggregator(Aggregator parent)protected voiddoPreCollection()Can be overridden by aggregator implementation to be called back when the collection phase starts.DeferringBucketCollectorgetDeferringCollector()protected voidrunDeferredCollections(long... bucketOrds)protected booleanshouldDefer(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.-
Methods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildAggregation, buildEmptyAggregation, descendsFromBucketAggregator
-
Methods inherited from class org.elasticsearch.search.aggregations.AggregatorBase
addRequestCircuitBreakerBytes, buildEmptySubAggregations, context, doClose, doPostCollection, getLeafCollector, getLeafCollector, metaData, name, needsScores, parent, pipelineAggregators, postCollection, preCollection, preGetSubLeafCollectors, subAggregator, subAggregators, toString
-
Methods inherited from class org.elasticsearch.search.aggregations.BucketCollector
wrap
-
Methods inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
bucketAggregations, bucketDocCount, bucketEmptyAggregations, close, collectBucket, collectExistingBucket, consumeBucketsAndMaybeBreak, getDocCounts, grow, incrementBucketDocCount, maxBucketOrd
-
-
-
-
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.IOExceptionDescription copied from class:AggregatorBaseCan be overridden by aggregator implementation to be called back when the collection phase starts.- Overrides:
doPreCollectionin classAggregatorBase- Throws:
java.io.IOException
-
descendsFromGlobalAggregator
public static boolean descendsFromGlobalAggregator(Aggregator parent)
-
getDeferringCollector
public DeferringBucketCollector getDeferringCollector()
-
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 callrunDeferredCollections(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
-
-