public abstract class Aggregator extends BucketCollector implements Releasable
| Modifier and Type | Class and Description |
|---|---|
static class |
Aggregator.BucketAggregationMode
Defines the nature of the aggregator's aggregation execution when nested in other aggregators and the buckets they create.
|
static interface |
Aggregator.Parser
Parses the aggregation request and creates the appropriate aggregator factory for it.
|
static class |
Aggregator.SubAggCollectionMode |
BucketCollector.BucketAnalysisCollector| Modifier and Type | Field and Description |
|---|---|
protected BigArrays |
bigArrays |
protected Aggregator.BucketAggregationMode |
bucketAggregationMode |
static ParseField |
COLLECT_MODE |
protected BucketCollector |
collectableSubAggregators |
protected AggregationContext |
context |
protected int |
depth |
protected long |
estimatedBucketCount |
protected AggregatorFactories |
factories |
protected String |
name |
protected Aggregator |
parent |
protected Aggregator[] |
subAggregators |
NO_OP_COLLECTOR| Modifier | Constructor and Description |
|---|---|
protected |
Aggregator(String name,
Aggregator.BucketAggregationMode bucketAggregationMode,
AggregatorFactories factories,
long estimatedBucketsCount,
AggregationContext context,
Aggregator parent)
Constructs a new Aggregator.
|
| Modifier and Type | Method and Description |
|---|---|
Aggregator.BucketAggregationMode |
bucketAggregationMode() |
abstract InternalAggregation |
buildAggregation(long owningBucketOrdinal) |
abstract InternalAggregation |
buildEmptyAggregation() |
protected InternalAggregations |
buildEmptySubAggregations() |
void |
close()
Called upon release of the aggregator.
|
AggregationContext |
context() |
int |
depth()
Return the depth of this aggregator in the aggregation tree.
|
protected void |
doClose()
Release instance-specific data.
|
protected void |
doPostCollection()
Can be overriden by aggregator implementation to be called back when the collection phase ends.
|
long |
estimatedBucketCount()
Return the estimated number of buckets.
|
void |
gatherAnalysis(BucketCollector.BucketAnalysisCollector results,
long bucketOrdinal)
Called post-collection to gather the results from surviving buckets.
|
static boolean |
hasParentBucketAggregator(Aggregator parent)
Returns whether any of the parent aggregators has
Aggregator.BucketAggregationMode.PER_BUCKET as a bucket aggregation mode. |
String |
name() |
Aggregator |
parent() |
void |
postCollection()
Called after collection of all document is done.
|
protected void |
preCollection() |
protected void |
runDeferredCollections(long... bucketOrds) |
abstract boolean |
shouldCollect() |
protected boolean |
shouldDefer(Aggregator aggregator)
This method should be overidden 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.
|
Aggregator |
subAggregator(String aggName) |
Aggregator[] |
subAggregators() |
collect, wrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetNextReaderpublic static final ParseField COLLECT_MODE
protected final String name
protected final Aggregator parent
protected final AggregationContext context
protected final BigArrays bigArrays
protected final int depth
protected final long estimatedBucketCount
protected final Aggregator.BucketAggregationMode bucketAggregationMode
protected final AggregatorFactories factories
protected final Aggregator[] subAggregators
protected BucketCollector collectableSubAggregators
protected Aggregator(String name, Aggregator.BucketAggregationMode bucketAggregationMode, AggregatorFactories factories, long estimatedBucketsCount, AggregationContext context, Aggregator parent)
name - The name of the aggregationbucketAggregationMode - The nature of execution as a sub-aggregator (see Aggregator.BucketAggregationMode)factories - The factories for all the sub-aggregators under this aggregatorestimatedBucketsCount - When served as a sub-aggregator, indicate how many buckets the parent aggregator will generate.context - The aggregation contextparent - The parent aggregator (may be null for top level aggregators)public static boolean hasParentBucketAggregator(Aggregator parent)
Aggregator.BucketAggregationMode.PER_BUCKET as a bucket aggregation mode.protected void preCollection()
protected boolean shouldDefer(Aggregator aggregator)
runDeferredCollections(long...)
for the selected set of buckets that survive the pruning.aggregator - the child aggregatorprotected void runDeferredCollections(long... bucketOrds)
public String name()
public final long estimatedBucketCount()
public final int depth()
public Aggregator parent()
null if there is none (meaning, this aggregator is a top level one)public Aggregator[] subAggregators()
public Aggregator subAggregator(String aggName)
public AggregationContext context()
public Aggregator.BucketAggregationMode bucketAggregationMode()
Aggregator.BucketAggregationModepublic abstract boolean shouldCollect()
public final void postCollection()
throws IOException
postCollection in class BucketCollectorIOExceptionpublic void close()
close in interface AutoCloseableclose in interface Releasableprotected void doClose()
protected void doPostCollection()
throws IOException
IOExceptionpublic abstract InternalAggregation buildAggregation(long owningBucketOrdinal)
public void gatherAnalysis(BucketCollector.BucketAnalysisCollector results, long bucketOrdinal)
BucketCollectorgatherAnalysis in class BucketCollectorpublic abstract InternalAggregation buildEmptyAggregation()
protected final InternalAggregations buildEmptySubAggregations()
Copyright © 2009–2016. All rights reserved.