Class InternalAggregations
java.lang.Object
org.elasticsearch.search.aggregations.Aggregations
org.elasticsearch.search.aggregations.InternalAggregations
- All Implemented Interfaces:
Iterable<Aggregation>,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
An internal implementation of
Aggregations.-
Nested Class Summary
Nested 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
FieldsFields inherited from class org.elasticsearch.search.aggregations.Aggregations
aggregations, AGGREGATIONS_FIELDFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionInternalAggregations(List<InternalAggregation> aggregations, Supplier<PipelineAggregator.PipelineTree> pipelineTreeSource)Constructs a node in the aggregation tree. -
Method Summary
Modifier and TypeMethodDescriptionMake a mutable copy of the aggregation results.static InternalAggregationsfrom(List<InternalAggregation> aggregations)Deprecated.these only exist for BWC serializationvoidMerge a PipelineAggregator.PipelineTree into this aggregation result tree before serializing to a node older than 7.8.0.static InternalAggregationsreadFrom(StreamInput in)static InternalAggregationsreduce(List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)Version ofreduce(List, ReduceContext, Function)for nodes inside the aggregation tree.static InternalAggregationsreduce(List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context, Function<List<InternalAggregation>,InternalAggregations> ctor)Reduces the given list of aggregations as well as the top-level pipeline aggregators extracted from the firstInternalAggregationsobject found in the list.doubleGet value to use when sorting by a descendant of the aggregation containing this.static InternalAggregationstopLevelReduce(List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)Begin the reduction process.voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.aggregations.Aggregations
asList, asMap, equals, fromXContent, get, getAsMap, hashCode, iterator, toXContent, toXContentInternalMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
-
Constructor Details
-
InternalAggregations
public InternalAggregations(List<InternalAggregation> aggregations, Supplier<PipelineAggregator.PipelineTree> pipelineTreeSource)Constructs a node in the aggregation tree.- Parameters:
pipelineTreeSource- must be null inside the tree or after final reduction. Should reference the search request otherwise so we can properly serialize the response to versions of Elasticsearch that require the pipelines to be serialized.
-
-
Method Details
-
from
-
readFrom
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
mergePipelineTreeForBWCSerialization
Merge a PipelineAggregator.PipelineTree into this aggregation result tree before serializing to a node older than 7.8.0. -
copyResults
Make a mutable copy of the aggregation results.IMPORTANT: The copy doesn't include any pipeline aggregations, if there are any.
-
getTopLevelPipelineAggregators
Deprecated.these only exist for BWC serializationGet the top level pipeline aggregators. -
sortValue
public double sortValue(AggregationPath.PathElement head, Iterator<AggregationPath.PathElement> tail)Get value to use when sorting by a descendant of the aggregation containing this. -
topLevelReduce
public static InternalAggregations topLevelReduce(List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)Begin the reduction process. This should be the entry point for the "first" reduction, e.g. called by SearchPhaseController or anywhere else that wants to initiate a reduction. It _should not_ be called as an intermediate reduction step (e.g. in the middle of an aggregation tree). This method first reduces the aggregations, and if it is the final reduce, then reduce the pipeline aggregations (both embedded parent/sibling as well as top-level sibling pipelines) -
reduce
public static InternalAggregations reduce(List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context, Function<List<InternalAggregation>,InternalAggregations> ctor)Reduces the given list of aggregations as well as the top-level pipeline aggregators extracted from the firstInternalAggregationsobject found in the list. Note that pipeline aggregations _are not_ reduced by this method. Pipelines are handled separately bytopLevelReduce(List, ReduceContext)- Parameters:
ctor- used to build theInternalAggregations. The top level reduce specifies a constructor that adds pipeline aggregation information that is used to send pipeline aggregations to older versions of Elasticsearch that require the pipeline aggregations to be returned as part of the aggregation tree
-
reduce
public static InternalAggregations reduce(List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)Version ofreduce(List, ReduceContext, Function)for nodes inside the aggregation tree.
-