Class InternalMultiBucketAggregation<A extends InternalMultiBucketAggregation,B extends InternalMultiBucketAggregation.InternalBucket>
java.lang.Object
org.elasticsearch.search.aggregations.InternalAggregation
org.elasticsearch.search.aggregations.InternalMultiBucketAggregation<A,B>
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment,Aggregation,MultiBucketsAggregation
- Direct Known Subclasses:
AbstractInternalTerms,InternalAdjacencyMatrix,InternalAutoDateHistogram,InternalBinaryRange,InternalComposite,InternalDateHistogram,InternalFilters,InternalGeoGrid,InternalHistogram,InternalRange,InternalRareTerms,InternalSignificantTerms,InternalVariableWidthHistogram
public abstract class InternalMultiBucketAggregation<A extends InternalMultiBucketAggregation,B extends InternalMultiBucketAggregation.InternalBucket>
extends InternalAggregation
implements MultiBucketsAggregation
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.InternalAggregation
InternalAggregation.ReduceContext, InternalAggregation.ReduceContextBuilderNested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFieldsNested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation
MultiBucketsAggregation.BucketNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.InternalAggregation
metadata, nameFields inherited from interface org.elasticsearch.search.aggregations.Aggregation
TYPED_KEYS_DELIMITERFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsModifierConstructorDescriptionInternalMultiBucketAggregation(String name, Map<String,Object> metadata)protectedRead from a stream. -
Method Summary
Modifier and TypeMethodDescriptionRewrite the sub-aggregations in the buckets in this aggregation.static intCounts the number of inner buckets inside the providedAggregationstatic intCounts the number of inner buckets inside the providedInternalMultiBucketAggregation.InternalBucketabstract ACreate a new copy of thisAggregationwith the same settings as thisAggregationand contains the provided buckets.abstract BcreateBucket(InternalAggregations aggregations, B prototype)Create a newInternalMultiBucketAggregation.InternalBucketusing the provided prototype bucket and aggregations.voidforEachBucket(Consumer<InternalAggregations> consumer)Run a Consumer over all buckets in this aggregation.getProperty(List<String> path)protected booleanSignal the framework if the InternalAggregation.reduce(List, ReduceContext) phase needs to be called when there is only one InternalAggregation.protected abstract BreduceBucket(List<B> buckets, InternalAggregation.ReduceContext context)Reduce a list of same-keyed buckets (from multiple shards) to a single bucket.reducePipelines(InternalAggregation reducedAggs, InternalAggregation.ReduceContext reduceContext, PipelineAggregator.PipelineTree pipelineTree)A multi-bucket agg needs to first reduce the buckets and *their* pipelines before allowing sibling pipelines to materialize.Methods inherited from class org.elasticsearch.search.aggregations.InternalAggregation
doWriteTo, doXContentBody, equals, getMetadata, getName, getProperty, getType, hashCode, isMapped, mergePipelineTreeForBWCSerialization, pipelineAggregatorsForBwcSerialization, readSize, reduce, sortValue, sortValue, toString, toXContent, writeSize, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.search.aggregations.Aggregation
getMetadata, getName, getTypeMethods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableNameMethods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContentMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
InternalMultiBucketAggregation
-
InternalMultiBucketAggregation
Read from a stream.- Throws:
IOException
-
-
Method Details
-
create
Create a new copy of thisAggregationwith the same settings as thisAggregationand contains the provided buckets.- Parameters:
buckets- the buckets to use in the newAggregation- Returns:
- the new
Aggregation
-
createBucket
Create a newInternalMultiBucketAggregation.InternalBucketusing the provided prototype bucket and aggregations.- Parameters:
aggregations- the aggregations for the new bucketprototype- the bucket to use as a prototype- Returns:
- the new bucket
-
reduceBucket
Reduce a list of same-keyed buckets (from multiple shards) to a single bucket. This requires all buckets to have the same key. -
getBuckets
- Specified by:
getBucketsin interfaceMultiBucketsAggregation- Returns:
- The buckets of this aggregation.
-
getProperty
- Specified by:
getPropertyin classInternalAggregation
-
countInnerBucket
Counts the number of inner buckets inside the providedInternalMultiBucketAggregation.InternalBucket -
countInnerBucket
Counts the number of inner buckets inside the providedAggregation -
reducePipelines
public final InternalAggregation reducePipelines(InternalAggregation reducedAggs, InternalAggregation.ReduceContext reduceContext, PipelineAggregator.PipelineTree pipelineTree)A multi-bucket agg needs to first reduce the buckets and *their* pipelines before allowing sibling pipelines to materialize.- Overrides:
reducePipelinesin classInternalAggregation
-
copyWithRewritenBuckets
public InternalAggregation copyWithRewritenBuckets(Function<InternalAggregations,InternalAggregations> rewriter)Description copied from class:InternalAggregationRewrite the sub-aggregations in the buckets in this aggregation. Returns a copy of this InternalAggregation with the rewritten buckets, or, if there aren't any modifications to the buckets then this method will return this aggregation. Either way, it doesn't modify this aggregation.Implementers of this should call the
rewriteronce per bucket with its InternalAggregations. Therewritershould returnnullif it doen't have any rewriting to do or it should return a new InternalAggregations to make changs.The default implementation throws an exception because most aggregations don't have buckets in them. It should be overridden by aggregations that contain buckets. Implementers should respect the description above.
- Overrides:
copyWithRewritenBucketsin classInternalAggregation
-
mustReduceOnSingleInternalAgg
protected boolean mustReduceOnSingleInternalAgg()Description copied from class:InternalAggregationSignal the framework if the InternalAggregation.reduce(List, ReduceContext) phase needs to be called when there is only one InternalAggregation.- Specified by:
mustReduceOnSingleInternalAggin classInternalAggregation
-
forEachBucket
Description copied from class:InternalAggregationRun a Consumer over all buckets in this aggregation.- Overrides:
forEachBucketin classInternalAggregation
-