public abstract class TermsAggregator extends DeferableBucketAggregator
| Modifier and Type | Class and Description |
|---|---|
static class |
TermsAggregator.BucketCountThresholds |
Aggregator.Parser, Aggregator.SubAggCollectionMode| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<Aggregator> |
aggsUsedForSorting |
protected TermsAggregator.BucketCountThresholds |
bucketCountThresholds |
protected Aggregator.SubAggCollectionMode |
collectMode |
protected DocValueFormat |
format |
protected BucketOrder |
order |
collectableSubAggregators, context, DEFAULT_WEIGHT, name, parent, subAggregatorsNO_OP_COLLECTOR| Constructor and Description |
|---|
TermsAggregator(java.lang.String name,
AggregatorFactories factories,
SearchContext context,
Aggregator parent,
TermsAggregator.BucketCountThresholds bucketCountThresholds,
BucketOrder order,
DocValueFormat format,
Aggregator.SubAggCollectionMode collectMode,
java.util.List<PipelineAggregator> pipelineAggregators,
java.util.Map<java.lang.String,java.lang.Object> metaData) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Comparator<MultiBucketsAggregation.Bucket> |
bucketComparator(AggregationPath path,
boolean asc)
Internal Optimization for ordering
InternalTerms.Buckets by a sub aggregation. |
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.
|
doPreCollection, getDeferringCollector, runDeferredCollectionsbucketAggregations, bucketDocCount, bucketEmptyAggregations, close, collectBucket, collectExistingBucket, getDocCounts, grow, incrementBucketDocCount, maxBucketOrdaddRequestCircuitBreakerBytes, buildEmptySubAggregations, context, doClose, doPostCollection, getLeafCollector, getLeafCollector, metaData, name, needsScores, parent, pipelineAggregators, postCollection, preCollection, preGetSubLeafCollectors, subAggregator, subAggregators, toStringbuildAggregation, buildEmptyAggregation, descendsFromBucketAggregatorwrapprotected final DocValueFormat format
protected final TermsAggregator.BucketCountThresholds bucketCountThresholds
protected final BucketOrder order
protected final java.util.Set<Aggregator> aggsUsedForSorting
protected final Aggregator.SubAggCollectionMode collectMode
public TermsAggregator(java.lang.String name,
AggregatorFactories factories,
SearchContext context,
Aggregator parent,
TermsAggregator.BucketCountThresholds bucketCountThresholds,
BucketOrder order,
DocValueFormat format,
Aggregator.SubAggCollectionMode collectMode,
java.util.List<PipelineAggregator> pipelineAggregators,
java.util.Map<java.lang.String,java.lang.Object> metaData)
throws java.io.IOException
java.io.IOExceptionpublic java.util.Comparator<MultiBucketsAggregation.Bucket> bucketComparator(AggregationPath path, boolean asc)
InternalTerms.Buckets by a sub aggregation.
in this phase, if the order is based on sub-aggregations, we need to use a different comparator to avoid constructing buckets for ordering purposes (we can potentially have a lot of buckets and building them will cause loads of redundant object constructions). The "special" comparators here will fetch the sub aggregation values directly from the sub aggregators bypassing bucket creation. Note that the comparator attached to the order will still be used in the reduce phase of the Aggregation.
path - determines which sub aggregation to use for ordering.asc - true for ascending order, false for descending.Comparator to order InternalTerms.Buckets in the desired order.protected boolean shouldDefer(Aggregator aggregator)
DeferableBucketAggregatorDeferableBucketAggregator.runDeferredCollections(long...) for the selected set
of buckets that survive the pruning.shouldDefer in class DeferableBucketAggregatoraggregator - the child aggregator