Class AdaptingAggregator
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.Aggregator
org.elasticsearch.search.aggregations.AdaptingAggregator
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,org.apache.lucene.search.Collector
,Releasable
public abstract class AdaptingAggregator extends Aggregator
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
Constructors Constructor Description AdaptingAggregator(Aggregator parent, AggregatorFactories subAggregators, org.elasticsearch.common.CheckedFunction<AggregatorFactories,Aggregator,java.io.IOException> delegate)
-
Method Summary
Modifier and Type Method Description protected abstract InternalAggregation
adapt(InternalAggregation delegateResult)
Adapt the result from the collecting Aggregator into the result expected by this Aggregator.InternalAggregation[]
buildAggregations(long[] owningBucketOrds)
Build the results of this aggregation.InternalAggregation
buildEmptyAggregation()
Build an empty aggregation.void
close()
void
collectDebugInfo(java.util.function.BiConsumer<java.lang.String,java.lang.Object> add)
Collect debug information to add to the profiling results.Aggregator
delegate()
LeafBucketCollector
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx)
java.lang.String
name()
Return the name of this aggregator.Aggregator
parent()
Return the parent aggregator.void
postCollection()
Post-collection callback.void
preCollection()
Pre collection callback.org.apache.lucene.search.ScoreMode
scoreMode()
Aggregator
subAggregator(java.lang.String name)
Return the sub aggregator with the provided name.Aggregator[]
subAggregators()
Get the aggregators running under this one.Methods inherited from class org.elasticsearch.search.aggregations.Aggregator
bucketComparator, buildTopLevel, resolveSortPath, resolveSortPathOnValidAgg
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AdaptingAggregator
public AdaptingAggregator(Aggregator parent, AggregatorFactories subAggregators, org.elasticsearch.common.CheckedFunction<AggregatorFactories,Aggregator,java.io.IOException> delegate) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Details
-
adapt
Adapt the result from the collecting Aggregator into the result expected by this Aggregator. -
close
public final void close() -
scoreMode
public final org.apache.lucene.search.ScoreMode scoreMode() -
name
public final java.lang.String name()Description copied from class:Aggregator
Return the name of this aggregator.- Specified by:
name
in classAggregator
-
parent
Description copied from class:Aggregator
Return the parent aggregator.- Specified by:
parent
in classAggregator
-
subAggregator
Description copied from class:Aggregator
Return the sub aggregator with the provided name.- Specified by:
subAggregator
in classAggregator
-
getLeafCollector
public final LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws java.io.IOException- Specified by:
getLeafCollector
in interfaceorg.apache.lucene.search.Collector
- Specified by:
getLeafCollector
in classBucketCollector
- Throws:
java.io.IOException
-
preCollection
public final void preCollection() throws java.io.IOExceptionDescription copied from class:BucketCollector
Pre collection callback.- Specified by:
preCollection
in classBucketCollector
- Throws:
java.io.IOException
-
postCollection
public final void postCollection() throws java.io.IOExceptionDescription copied from class:BucketCollector
Post-collection callback.- Specified by:
postCollection
in classBucketCollector
- Throws:
java.io.IOException
-
buildAggregations
public final InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws java.io.IOExceptionDescription copied from class:Aggregator
Build the results of this aggregation.- Specified by:
buildAggregations
in 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:
java.io.IOException
-
buildEmptyAggregation
Description copied from class:Aggregator
Build an empty aggregation.- Specified by:
buildEmptyAggregation
in classAggregator
-
subAggregators
Description copied from class:Aggregator
Get the aggregators running under this one.- Specified by:
subAggregators
in classAggregator
-
collectDebugInfo
public void collectDebugInfo(java.util.function.BiConsumer<java.lang.String,java.lang.Object> add)Description copied from class:Aggregator
Collect 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:
collectDebugInfo
in classAggregator
-
delegate
-