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
InternalAggregation
s-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.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
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Method Summary
Modifier and TypeMethodDescriptionasList()
The list ofInternalAggregation
s.asMap()
Returns theInternalAggregation
s keyed by aggregation name.Make a mutable copy of the aggregation results.boolean
static InternalAggregations
finalizeSampling
(InternalAggregations internalAggregations, SamplingContext samplingContext) Finalizes the sampling for all the internal aggregationsstatic InternalAggregations
from
(List<InternalAggregation> aggregations) static InternalAggregations
fromXContent
(XContentParser parser) <A extends InternalAggregation>
AReturns the aggregation that is associated with the specified name.getAsMap()
Returns theInternalAggregation
s keyed by aggregation name.int
hashCode()
iterator()
Iterates over theInternalAggregation
s.static InternalAggregations
readFrom
(StreamInput in) 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 firstInternalAggregations
object found in the list.Get value to use when sorting by a descendant of the aggregation containing this.static InternalAggregations
topLevelReduce
(List<InternalAggregations> aggregationsList, AggregationReduceContext context) Begin the reduction process.static InternalAggregations
topLevelReduceDelayable
(List<DelayableWriteable<InternalAggregations>> delayableAggregations, AggregationReduceContext context) Equivalent totopLevelReduce(List, AggregationReduceContext)
but it takes a list ofDelayableWriteable
.toXContent
(XContentBuilder builder, ToXContent.Params params) toXContentInternal
(XContentBuilder builder, ToXContent.Params params) Directly write all the aggregations without their bounding object.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
AGGREGATIONS_FIELD
- See Also:
-
EMPTY
-
-
Method Details
-
iterator
Iterates over theInternalAggregation
s.- Specified by:
iterator
in interfaceIterable<InternalAggregation>
-
asList
The list ofInternalAggregation
s. -
asMap
Returns theInternalAggregation
s keyed by aggregation name. -
getAsMap
Returns theInternalAggregation
s keyed by aggregation name. -
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:
toXContent
in 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
-
readFrom
- Throws:
IOException
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in 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. -
topLevelReduceDelayable
public static InternalAggregations topLevelReduceDelayable(List<DelayableWriteable<InternalAggregations>> delayableAggregations, AggregationReduceContext context) Equivalent totopLevelReduce(List, AggregationReduceContext)
but it takes a list ofDelayableWriteable
. The object will be expanded once viaDelayableWriteable.expand()
but it is the responsibility of the caller to release those releasables. -
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 firstInternalAggregations
object found in the list. Note that pipeline aggregations _are not_ reduced by this method. Pipelines are handled separately bytopLevelReduce(List, AggregationReduceContext)
-
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
-