Class BucketsAggregator
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.Aggregator
org.elasticsearch.search.aggregations.AggregatorBase
org.elasticsearch.search.aggregations.bucket.BucketsAggregator
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.lucene.search.Collector,Releasable
- Direct Known Subclasses:
AdjacencyMatrixAggregator,BinaryRangeAggregator,DeferableBucketAggregator,FilterAggregator,FiltersAggregator,GeoGridAggregator,GlobalAggregator,MissingAggregator,NestedAggregator,RangeAggregator,RangeHistogramAggregator,ReverseNestedAggregator,SignificantTextAggregator
public abstract class BucketsAggregator extends AggregatorBase
-
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 -
Constructor Summary
Constructors Constructor Description 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) -
Method Summary
Modifier and Type Method Description protected InternalAggregationsbucketAggregations(long bucket)Required method to build the child aggregations of the given bucket (identified by the bucket ordinal).intbucketDocCount(long bucketOrd)Utility method to return the number of documents that fell in the given bucket (identified by the bucket ordinal)protected InternalAggregationsbucketEmptyAggregations()Utility method to build empty aggregations of the sub aggregators.voidclose()Called upon release of the aggregator.voidcollectBucket(LeafBucketCollector subCollector, int doc, long bucketOrd)Utility method to collect the given doc in the given bucket (identified by the bucket ordinal)voidcollectExistingBucket(LeafBucketCollector subCollector, int doc, long bucketOrd)Same ascollectBucket(LeafBucketCollector, int, long), but doesn't check if the docCounts needs to be re-sized.protected voidconsumeBucketsAndMaybeBreak(int count)Addscountbuckets to the global count for the request and fails if this number is greater than the maximum number of buckets allowed in a responseIntArraygetDocCounts()voidgrow(long maxBucketOrd)Ensure there are at leastmaxBucketOrdbuckets available.voidincrementBucketDocCount(long bucketOrd, int inc)Utility method to increment the doc counts of the given bucket (identified by the bucket ordinal)longmaxBucketOrd()Return an upper bound of the maximum bucket ordinal seen so far.voidmergeBuckets(long[] mergeMap, long newNumBuckets)Methods inherited from class org.elasticsearch.search.aggregations.AggregatorBase
addRequestCircuitBreakerBytes, buildEmptySubAggregations, context, doClose, doPostCollection, doPreCollection, getLeafCollector, getLeafCollector, metaData, name, parent, pipelineAggregators, postCollection, preCollection, preGetSubLeafCollectors, scoreMode, subAggregator, subAggregators, toStringMethods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildAggregation, buildEmptyAggregation, descendsFromBucketAggregator
-
Constructor Details
-
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 Details
-
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 leastmaxBucketOrdbuckets available. -
collectBucket
public final void collectBucket(LeafBucketCollector subCollector, int doc, long bucketOrd) throws java.io.IOExceptionUtility method to collect the given doc in the given bucket (identified by the bucket ordinal)- Throws:
java.io.IOException
-
collectExistingBucket
public final void collectExistingBucket(LeafBucketCollector subCollector, int doc, long bucketOrd) throws java.io.IOExceptionSame ascollectBucket(LeafBucketCollector, int, long), but doesn't check if the docCounts needs to be re-sized.- Throws:
java.io.IOException
-
mergeBuckets
public final void mergeBuckets(long[] mergeMap, long newNumBuckets) -
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)Addscountbuckets 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
Required method to build the child aggregations of the given bucket (identified by the bucket ordinal).- Throws:
java.io.IOException
-
bucketEmptyAggregations
Utility method to build empty aggregations of the sub aggregators. -
close
public final void close()Description copied from class:AggregatorBaseCalled upon release of the aggregator.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceReleasable- Overrides:
closein classAggregatorBase
-