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:
AbstractRareTermsAggregator,SamplerAggregator,TermsAggregator,VariableWidthHistogramAggregator
public abstract class DeferableBucketAggregator extends BucketsAggregator
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
BucketsAggregator.BucketBuilderForFixedCount<B>, BucketsAggregator.BucketBuilderForVariable<B>, BucketsAggregator.ResultBuilderForVariable<B>, BucketsAggregator.SingleBucketResultBuilderNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.Aggregator
Aggregator.BucketComparator, Aggregator.Parser, Aggregator.SubAggCollectionMode -
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.AggregatorBase
collectableSubAggregators, context, DEFAULT_WEIGHT, name, parent, subAggregators -
Constructor Summary
Constructors Modifier Constructor Description protectedDeferableBucketAggregator(java.lang.String name, AggregatorFactories factories, SearchContext context, Aggregator parent, java.util.Map<java.lang.String,java.lang.Object> metadata) -
Method Summary
Modifier and Type Method Description protected voidbeforeBuildingBuckets(long[] ordsToCollect)Hook to allow taking an action before building buckets.voidcollectDebugInfo(java.util.function.BiConsumer<java.lang.String,java.lang.Object> add)Collect debug information to add to the profiling results.protected voiddoPreCollection()Can be overridden by aggregator implementation to be called back when the collection phase starts.DeferringBucketCollectorgetDeferringCollector()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.bucket.BucketsAggregator
bucketComparator, bucketDocCount, buildAggregationsForFixedBucketCount, buildAggregationsForSingleBucket, buildAggregationsForVariableBuckets, buildSubAggsForAllBuckets, buildSubAggsForBuckets, buildSubAggsForBuckets, close, collectBucket, collectExistingBucket, descendsFromGlobalAggregator, getDocCounts, grow, incrementBucketDocCount, maxBucketOrd, mergeBuckets, mergeBuckets, resolveSortPathMethods inherited from class org.elasticsearch.search.aggregations.AggregatorBase
addRequestCircuitBreakerBytes, buildEmptySubAggregations, context, doClose, doPostCollection, getLeafCollector, getLeafCollector, metadata, name, parent, pointReaderIfAvailable, postCollection, preCollection, preGetSubLeafCollectors, scoreMode, subAggregator, subAggregators, toStringMethods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildAggregations, buildEmptyAggregation, buildTopLevel, resolveSortPathOnValidAgg
-
Constructor Details
-
DeferableBucketAggregator
protected DeferableBucketAggregator(java.lang.String name, AggregatorFactories factories, SearchContext context, Aggregator parent, java.util.Map<java.lang.String,java.lang.Object> metadata) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Details
-
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
-
getDeferringCollector
-
shouldDefer
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.- Parameters:
aggregator- the child aggregator- Returns:
- true if the aggregator should be deferred until a first pass at collection has completed
-
beforeBuildingBuckets
protected void beforeBuildingBuckets(long[] ordsToCollect) throws java.io.IOExceptionDescription copied from class:BucketsAggregatorHook to allow taking an action before building buckets.- Overrides:
beforeBuildingBucketsin classBucketsAggregator- Throws:
java.io.IOException
-
collectDebugInfo
public void collectDebugInfo(java.util.function.BiConsumer<java.lang.String,java.lang.Object> add)Description copied from class:AggregatorCollect debug information to add to the profiling results. This will only be called if the aggregation is being profiled.Well behaved implementations will always call the superclass implementation just in case it has something interesting. They will also only add objects which can be serialized with
StreamOutput.writeGenericValue(Object)andXContentBuilder.value(Object). And they'll have an integration test.- Overrides:
collectDebugInfoin classAggregator
-