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.SingleBucketResultBuilder
Nested 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 protected
DeferableBucketAggregator(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 void
beforeBuildingBuckets(long[] ordsToCollect)
Hook to allow taking an action before building buckets.void
collectDebugInfo(java.util.function.BiConsumer<java.lang.String,java.lang.Object> add)
Collect debug information to add to the profiling results.protected void
doPreCollection()
Can be overridden by aggregator implementation to be called back when the collection phase starts.DeferringBucketCollector
getDeferringCollector()
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.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, resolveSortPath
Methods 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, toString
Methods 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:AggregatorBase
Can be overridden by aggregator implementation to be called back when the collection phase starts.- Overrides:
doPreCollection
in 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:BucketsAggregator
Hook to allow taking an action before building buckets.- Overrides:
beforeBuildingBuckets
in classBucketsAggregator
- Throws:
java.io.IOException
-
collectDebugInfo
public void collectDebugInfo(java.util.function.BiConsumer<java.lang.String,java.lang.Object> add)Description copied from class:Aggregator
Collect 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:
collectDebugInfo
in classAggregator
-