Module org.elasticsearch.server
Class InternalAggregations
java.lang.Object
org.elasticsearch.search.aggregations.InternalAggregations
- All Implemented Interfaces:
Iterable<InternalAggregation>,Writeable,ToXContent,ToXContentFragment
public final class InternalAggregations
extends Object
implements Iterable<InternalAggregation>, ToXContentFragment, Writeable
Represents a set of
InternalAggregations-
Nested Class Summary
Nested 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
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS -
Method Summary
Modifier and TypeMethodDescriptionstatic InternalAggregationsappend(InternalAggregations aggs, InternalAggregation toAppend) asList()The list ofInternalAggregations.Make a mutable copy of the aggregation results.booleanstatic InternalAggregationsfinalizeSampling(InternalAggregations internalAggregations, SamplingContext samplingContext) Finalizes the sampling for all the internal aggregationsstatic InternalAggregationsfrom(List<InternalAggregation> aggregations) static InternalAggregationsfrom(InternalAggregation aggregation) static InternalAggregationsfromXContent(XContentParser parser) <A extends InternalAggregation>
AReturns the aggregation that is associated with the specified name.inthashCode()iterator()Iterates over theInternalAggregations.static InternalAggregationsreadFrom(StreamInput in) static InternalAggregationsreduce(List<InternalAggregations> aggregationsList, AggregationReduceContext context) Reduces the given list of aggregations as well as the top-level pipeline aggregators extracted from the firstInternalAggregationsobject found in the list.static InternalAggregationsreduce(InternalAggregations aggregations, AggregationReduceContext context) Get value to use when sorting by a descendant of the aggregation containing this.static InternalAggregationstopLevelReduce(Iterator<InternalAggregations> aggs, int count, AggregationReduceContext context) Equivalent totopLevelReduce(List, AggregationReduceContext)but it takes an iterator and a count.static InternalAggregationstopLevelReduce(List<InternalAggregations> aggregationsList, AggregationReduceContext context) Begin the reduction process.toXContent(XContentBuilder builder, ToXContent.Params params) toXContentInternal(XContentBuilder builder, ToXContent.Params params) Directly write all the aggregations without their bounding object.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods 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.xcontent.ToXContentFragment
isFragment
-
Field Details
-
AGGREGATIONS_FIELD
- See Also:
-
EMPTY
-
-
Method Details
-
iterator
Iterates over theInternalAggregations.- Specified by:
iteratorin interfaceIterable<InternalAggregation>
-
asList
The list ofInternalAggregations. -
get
Returns the aggregation that is associated with the specified name. -
equals
-
hashCode
public int hashCode() -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
toXContentInternal
public XContentBuilder toXContentInternal(XContentBuilder builder, ToXContent.Params params) throws IOException Directly write all the aggregations without their bounding object. Used by sub-aggregations (non top level aggs)- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
from
-
from
-
append
-
readFrom
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
copyResults
Make a mutable copy of the aggregation results. -
sortValue
public SortValue 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(Iterator<InternalAggregations> aggs, int count, AggregationReduceContext context) Equivalent totopLevelReduce(List, AggregationReduceContext)but it takes an iterator and a count. -
topLevelReduce
public static InternalAggregations topLevelReduce(List<InternalAggregations> aggregationsList, AggregationReduceContext 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, AggregationReduceContext context) 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, AggregationReduceContext) -
reduce
public static InternalAggregations reduce(InternalAggregations aggregations, AggregationReduceContext context) -
finalizeSampling
public static InternalAggregations finalizeSampling(InternalAggregations internalAggregations, SamplingContext samplingContext) Finalizes the sampling for all the internal aggregations- Parameters:
samplingContext- the sampling context- Returns:
- the finalized aggregations
-