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
-
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR
-
-
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 InternalAggregations
bucketAggregations(long bucket)
Required method to build the child aggregations of the given bucket (identified by the bucket ordinal).int
bucketDocCount(long bucketOrd)
Utility method to return the number of documents that fell in the given bucket (identified by the bucket ordinal)protected InternalAggregations
bucketEmptyAggregations()
Utility method to build empty aggregations of the sub aggregators.void
close()
Called upon release of the aggregator.void
collectBucket(LeafBucketCollector subCollector, int doc, long bucketOrd)
Utility method to collect the given doc in the given bucket (identified by the bucket ordinal)void
collectExistingBucket(LeafBucketCollector subCollector, int doc, long bucketOrd)
Same ascollectBucket(LeafBucketCollector, int, long)
, but doesn't check if the docCounts needs to be re-sized.protected void
consumeBucketsAndMaybeBreak(int count)
Addscount
buckets to the global count for the request and fails if this number is greater than the maximum number of buckets allowed in a responseIntArray
getDocCounts()
void
grow(long maxBucketOrd)
Ensure there are at leastmaxBucketOrd
buckets available.void
incrementBucketDocCount(long bucketOrd, int inc)
Utility method to increment the doc counts of the given bucket (identified by the bucket ordinal)long
maxBucketOrd()
Return an upper bound of the maximum bucket ordinal seen so far.void
mergeBuckets(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, toString
-
Methods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildAggregation, buildEmptyAggregation, descendsFromBucketAggregator
-
-
-
-
Constructor Detail
-
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 Detail
-
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 leastmaxBucketOrd
buckets available.
-
collectBucket
public final void collectBucket(LeafBucketCollector subCollector, int doc, long bucketOrd) throws java.io.IOException
Utility 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.IOException
Same 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
public IntArray 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)
Addscount
buckets 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
protected final InternalAggregations bucketAggregations(long bucket) throws java.io.IOException
Required method to build the child aggregations of the given bucket (identified by the bucket ordinal).- Throws:
java.io.IOException
-
bucketEmptyAggregations
protected final InternalAggregations bucketEmptyAggregations()
Utility method to build empty aggregations of the sub aggregators.
-
close
public final void close()
Description copied from class:AggregatorBase
Called upon release of the aggregator.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceReleasable
- Overrides:
close
in classAggregatorBase
-
-