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 interface
Aggregator.BucketComparator
Compare two buckets by their ordinal.static interface
Aggregator.Parser
Parses the aggregation request and creates the appropriate aggregator factory for it.static class
Aggregator.SubAggCollectionMode
Aggregation mode for sub aggregations. -
Field Summary
-
Constructor Summary
Constructors Constructor Description Aggregator()
-
Method Summary
Modifier and Type Method Description Aggregator.BucketComparator
bucketComparator(java.lang.String key, SortOrder order)
Builds a comparator that compares two buckets aggregated by this Aggregator.abstract InternalAggregation
buildAggregation(long bucket)
Build an aggregation for data that has been collected intobucket
.abstract InternalAggregation
buildEmptyAggregation()
Build an empty aggregation.abstract SearchContext
context()
Return theSearchContext
attached with thisAggregator
.static boolean
descendsFromBucketAggregator(Aggregator parent)
Returns whether one of the parents is aBucketsAggregator
.abstract java.lang.String
name()
Return the name of this aggregator.abstract Aggregator
parent()
Return the parent aggregator.Aggregator
resolveSortPath(AggregationPath.PathElement next, java.util.Iterator<AggregationPath.PathElement> path)
Resolve a sort path to the target.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.abstract Aggregator
subAggregator(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 theSearchContext
attached 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
terms
aggs supports sorting its buckets, but that sort path itself can't contain a differentterms
aggregation. -
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.
-