Class InternalAggregations
java.lang.Object
org.elasticsearch.search.aggregations.Aggregations
org.elasticsearch.search.aggregations.InternalAggregations
- All Implemented Interfaces:
java.lang.Iterable<Aggregation>
,Writeable
,ToXContent
,ToXContentFragment
public final class InternalAggregations extends Aggregations implements Writeable
An internal implementation of
Aggregations
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static InternalAggregations
EMPTY
Fields inherited from class org.elasticsearch.search.aggregations.Aggregations
aggregations, AGGREGATIONS_FIELD
-
Constructor Summary
Constructors Constructor Description InternalAggregations(java.util.List<InternalAggregation> aggregations)
Constructs a new aggregation.InternalAggregations(java.util.List<InternalAggregation> aggregations, java.util.List<SiblingPipelineAggregator> topLevelPipelineAggregators)
Constructs a new aggregation providing itsInternalAggregation
s andSiblingPipelineAggregator
sInternalAggregations(StreamInput in)
-
Method Summary
Modifier and Type Method Description java.util.List<InternalAggregation>
copyResults()
Make a mutable copy of the aggregation results.java.util.List<SiblingPipelineAggregator>
getTopLevelPipelineAggregators()
Returns the top-level pipeline aggregators.static InternalAggregations
reduce(java.util.List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)
Reduces the given list of aggregations as well as the top-level pipeline aggregators extracted from the firstInternalAggregations
object found in the list.double
sortValue(AggregationPath.PathElement head, java.util.Iterator<AggregationPath.PathElement> tail)
Get value to use when sorting by a descendant of the aggregation containing this.static InternalAggregations
topLevelReduce(java.util.List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)
Begin the reduction process.void
writeTo(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, toXContentInternal
-
Field Details
-
Constructor Details
-
InternalAggregations
Constructs a new aggregation. -
InternalAggregations
public InternalAggregations(java.util.List<InternalAggregation> aggregations, java.util.List<SiblingPipelineAggregator> topLevelPipelineAggregators)Constructs a new aggregation providing itsInternalAggregation
s andSiblingPipelineAggregator
s -
InternalAggregations
- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
copyResults
Make a mutable copy of the aggregation results.IMPORTANT: The copy doesn't include any pipeline aggregations, if there are any.
-
getTopLevelPipelineAggregators
Returns the top-level pipeline aggregators. Note that top-level pipeline aggregators become normal aggregation once the final reduction has been performed, after which they become part of the list ofInternalAggregation
s. -
sortValue
public double sortValue(AggregationPath.PathElement head, java.util.Iterator<AggregationPath.PathElement> tail)Get value to use when sorting by a descendant of the aggregation containing this. -
topLevelReduce
public static InternalAggregations topLevelReduce(java.util.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(java.util.List<InternalAggregations> aggregationsList, InternalAggregation.ReduceContext context)Reduces the given list of aggregations as well as the top-level pipeline aggregators extracted from the firstInternalAggregations
object found in the list. Note that pipeline aggregations _are not_ reduced by this method. Pipelines are handled separately bytopLevelReduce(List, ReduceContext)
-