Class AdaptingAggregator
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.Aggregator
org.elasticsearch.search.aggregations.AdaptingAggregator
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.search.Collector,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
StringTermsAggregatorFromFilters
An Aggregator that delegates collection to another
Aggregator and then translates its results into the results
you'd expect from another aggregation.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.Aggregator
Aggregator.BucketComparator, Aggregator.Parser, Aggregator.SubAggCollectionMode -
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR -
Constructor Summary
ConstructorsConstructorDescriptionAdaptingAggregator(Aggregator parent, AggregatorFactories subAggregators, org.elasticsearch.core.CheckedFunction<AggregatorFactories,? extends Aggregator,IOException> delegate) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract InternalAggregationadapt(InternalAggregation delegateResult)Adapt the result from the collecting Aggregator into the result expected by this Aggregator.buildAggregations(long[] owningBucketOrds)Build the results of this aggregation.Build an empty aggregation.voidclose()voidCollect debug information to add to the profiling results.delegate()getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx)name()Return the name of this aggregator.parent()Return the parent aggregator.voidPost-collection callback.voidPre collection callback.org.apache.lucene.search.ScoreModesubAggregator(String name)Return the sub aggregator with the provided name.Get the aggregators running under this one.Methods inherited from class org.elasticsearch.search.aggregations.Aggregator
bucketComparator, buildTopLevel, resolveSortPath, resolveSortPathOnValidAgg
-
Constructor Details
-
AdaptingAggregator
public AdaptingAggregator(Aggregator parent, AggregatorFactories subAggregators, org.elasticsearch.core.CheckedFunction<AggregatorFactories,? extends Aggregator,IOException> delegate) throws IOException- Throws:
IOException
-
-
Method Details
-
adapt
Adapt the result from the collecting Aggregator into the result expected by this Aggregator.- Throws:
IOException
-
close
public final void close() -
scoreMode
public final org.apache.lucene.search.ScoreMode scoreMode() -
name
Description copied from class:AggregatorReturn the name of this aggregator.- Specified by:
namein classAggregator
-
parent
Description copied from class:AggregatorReturn the parent aggregator.- Specified by:
parentin classAggregator
-
subAggregator
Description copied from class:AggregatorReturn the sub aggregator with the provided name.- Specified by:
subAggregatorin classAggregator
-
getLeafCollector
public final LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws IOException- Specified by:
getLeafCollectorin interfaceorg.apache.lucene.search.Collector- Specified by:
getLeafCollectorin classBucketCollector- Throws:
IOException
-
preCollection
Description copied from class:BucketCollectorPre collection callback.- Specified by:
preCollectionin classBucketCollector- Throws:
IOException
-
postCollection
Description copied from class:BucketCollectorPost-collection callback.- Specified by:
postCollectionin classBucketCollector- Throws:
IOException
-
buildAggregations
Description copied from class:AggregatorBuild the results of this aggregation.- Specified by:
buildAggregationsin classAggregator- Parameters:
owningBucketOrds- the ordinals of the buckets that we want to collect from this aggregation- Returns:
- the results for each ordinal, in the same order as the array of ordinals
- Throws:
IOException
-
buildEmptyAggregation
Description copied from class:AggregatorBuild an empty aggregation.- Specified by:
buildEmptyAggregationin classAggregator
-
subAggregators
Description copied from class:AggregatorGet the aggregators running under this one.- Specified by:
subAggregatorsin classAggregator
-
collectDebugInfo
Description copied from class:AggregatorCollect debug information to add to the profiling results. This will only be called if the aggregation is being profiled.Well behaved implementations will always call the superclass implementation just in case it has something interesting. They will also only add objects which can be serialized with
StreamOutput.writeGenericValue(Object)andXContentBuilder.value(Object). And they'll have an integration test.- Overrides:
collectDebugInfoin classAggregator
-
delegate
-