Class Aggregator
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.Aggregator
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.lucene.search.Collector,Releasable
- Direct Known Subclasses:
AggregatorBase,AggregatorFactory.MultiBucketAggregatorWrapper,DeferringBucketCollector.WrappedAggregator,ProfilingAggregator
public abstract class Aggregator extends BucketCollector implements Releasable
An Aggregator.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAggregator.BucketComparatorCompare two buckets by their ordinal.static interfaceAggregator.ParserParses the aggregation request and creates the appropriate aggregator factory for it.static classAggregator.SubAggCollectionModeAggregation mode for sub aggregations. -
Field Summary
-
Constructor Summary
Constructors Constructor Description Aggregator() -
Method Summary
Modifier and Type Method Description Aggregator.BucketComparatorbucketComparator(java.lang.String key, SortOrder order)Builds a comparator that compares two buckets aggregated by this Aggregator.abstract InternalAggregationbuildAggregation(long bucket)Build an aggregation for data that has been collected intobucket.abstract InternalAggregationbuildEmptyAggregation()Build an empty aggregation.abstract SearchContextcontext()Return theSearchContextattached with thisAggregator.static booleandescendsFromBucketAggregator(Aggregator parent)Returns whether one of the parents is aBucketsAggregator.abstract java.lang.Stringname()Return the name of this aggregator.abstract Aggregatorparent()Return the parent aggregator.AggregatorresolveSortPath(AggregationPath.PathElement next, java.util.Iterator<AggregationPath.PathElement> path)Resolve a sort path to the target.AggregatorresolveSortPathOnValidAgg(AggregationPath.PathElement next, java.util.Iterator<AggregationPath.PathElement> path)Resolve the next step of the sort path as though this aggregation supported sorting.abstract AggregatorsubAggregator(java.lang.String name)Return the sub aggregator with the provided name.Methods inherited from class org.elasticsearch.search.aggregations.BucketCollector
getLeafCollector, postCollection, preCollection
-
Constructor Details
-
Aggregator
public Aggregator()
-
-
Method Details
-
descendsFromBucketAggregator
Returns whether one of the parents is aBucketsAggregator. -
name
public abstract java.lang.String name()Return the name of this aggregator. -
context
Return theSearchContextattached with thisAggregator. -
parent
Return the parent aggregator. -
subAggregator
Return the sub aggregator with the provided name. -
resolveSortPathOnValidAgg
public final Aggregator resolveSortPathOnValidAgg(AggregationPath.PathElement next, java.util.Iterator<AggregationPath.PathElement> path)Resolve the next step of the sort path as though this aggregation supported sorting. This is usually the "first step" when resolving a sort path because most aggs that support sorting their buckets aren't valid in the middle of a sort path.For example, the
termsaggs supports sorting its buckets, but that sort path itself can't contain a differenttermsaggregation. -
resolveSortPath
public Aggregator resolveSortPath(AggregationPath.PathElement next, java.util.Iterator<AggregationPath.PathElement> path)Resolve a sort path to the target.The default implementation throws an exception but we override it on aggregations that support sorting.
-
bucketComparator
Builds a comparator that compares two buckets aggregated by this Aggregator.The default implementation throws an exception but we override it on aggregations that support sorting.
-
buildAggregation
Build an aggregation for data that has been collected intobucket.- Throws:
java.io.IOException
-
buildEmptyAggregation
Build an empty aggregation.
-