Module org.elasticsearch.server
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,Aggregation,MultiBucketsAggregation,ToXContent,ToXContentFragment
- Direct Known Subclasses:
AbstractInternalTerms,InternalBinaryRange,InternalComposite,InternalDateHistogram,InternalFilters,InternalGeoGrid,InternalHistogram,InternalIpPrefix,InternalRange,InternalRareTerms,InternalSignificantTerms,InternalVariableWidthHistogram
public abstract class InternalMultiBucketAggregation<A extends InternalMultiBucketAggregation,B extends InternalMultiBucketAggregation.InternalBucket>
extends InternalAggregation
implements MultiBucketsAggregation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classHelps to lazily construct the aggregation list for reductionstatic classstatic classAInternalMultiBucketAggregation.InternalBucketthat implements theWriteableinterface.Nested 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.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intWhen we pre-count the empty buckets we report them periodically because you can configure the date_histogram to create an astounding number of buckets.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.xcontent.ToXContent
EMPTY, 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 AggregatorReducer phase needs to be called when there is only one InternalAggregation.final InternalAggregationreducePipelines(InternalAggregation reducedAggs, AggregationReduceContext 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
canLeadReduction, doWriteTo, doXContentBody, equals, finalizeSampling, getLeaderReducer, getMetadata, getName, getProperty, getReducer, getType, hashCode, readSize, 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.xcontent.ToXContent
toXContentMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
REPORT_EMPTY_EVERY
public static final int REPORT_EMPTY_EVERYWhen we pre-count the empty buckets we report them periodically because you can configure the date_histogram to create an astounding number of buckets. It'd take a while to count that high only to abort. So we report every couple thousand buckets. It's be simpler to report every single bucket we plan to allocate one at a time but that'd cause needless overhead on the circuit breakers. Counting a couple thousand buckets is plenty fast to fail this quickly in pathological cases and plenty large to keep the overhead minimal.- See Also:
-
-
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
-
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, AggregationReduceContext 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 AggregatorReducer 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
-