Class InternalAggregation
- java.lang.Object
-
- org.elasticsearch.search.aggregations.InternalAggregation
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment,Aggregation
- Direct Known Subclasses:
InternalGeoBounds,InternalGeoCentroid,InternalMultiBucketAggregation,InternalNumericMetricsAggregation,InternalScriptedMetric,InternalSingleBucketAggregation,InternalTopHits
public abstract class InternalAggregation extends java.lang.Object implements Aggregation, NamedWriteable
An internal implementation ofAggregation. Serves as a base class for all aggregation implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInternalAggregation.ReduceContext-
Nested classes/interfaces inherited from interface org.elasticsearch.search.aggregations.Aggregation
Aggregation.CommonFields
-
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 protected java.util.Map<java.lang.String,java.lang.Object>metaDataprotected java.lang.Stringname-
Fields inherited from interface org.elasticsearch.search.aggregations.Aggregation
TYPED_KEYS_DELIMITER
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInternalAggregation(java.lang.String name, java.util.List<PipelineAggregator> pipelineAggregators, java.util.Map<java.lang.String,java.lang.Object> metaData)Constructs an get with a given name.protectedInternalAggregation(StreamInput in)Read from a stream.
-
Method Summary
Modifier and Type Method Description abstract InternalAggregationdoReduce(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)protected abstract voiddoWriteTo(StreamOutput out)abstract XContentBuilderdoXContentBody(XContentBuilder builder, ToXContent.Params params)booleanequals(java.lang.Object obj)java.util.Map<java.lang.String,java.lang.Object>getMetaData()Get the optional byte array metadata that was set on the aggregationjava.lang.StringgetName()java.lang.ObjectgetProperty(java.lang.String path)Get the value of specified path in the aggregation.abstract java.lang.ObjectgetProperty(java.util.List<java.lang.String> path)java.lang.StringgetType()inthashCode()booleanisMapped()Return true if this aggregation is mapped, and can lead a reduction.java.util.List<PipelineAggregator>pipelineAggregators()protected static intreadSize(StreamInput in)Read a size under the assumption that a value of 0 means unlimited.InternalAggregationreduce(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)Reduces the given aggregations to a single one and returns it.java.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)protected static voidwriteSize(int size, StreamOutput out)Write a size under the assumption that a value of 0 means unlimited.voidwriteTo(StreamOutput out)Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableName
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Constructor Detail
-
InternalAggregation
protected InternalAggregation(java.lang.String name, java.util.List<PipelineAggregator> pipelineAggregators, java.util.Map<java.lang.String,java.lang.Object> metaData)Constructs an get with a given name.- Parameters:
name- The name of the get.
-
InternalAggregation
protected InternalAggregation(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public final void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:WriteableWrite this into the StreamOutput.
-
doWriteTo
protected abstract void doWriteTo(StreamOutput out) throws java.io.IOException
- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceAggregation- Returns:
- The name of this aggregation.
-
reduce
public final InternalAggregation reduce(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)
Reduces the given aggregations to a single one and returns it. In most cases, the assumption will be the all given aggregations are of the same type (the same type as this aggregation). For best efficiency, when implementing, try reusing an existing instance (typically the first in the given list) to save on redundant object construction.
-
doReduce
public abstract InternalAggregation doReduce(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)
-
isMapped
public boolean isMapped()
Return true if this aggregation is mapped, and can lead a reduction. If this agg returns false, it should return itself if asked to lead a reduction
-
getProperty
public java.lang.Object getProperty(java.lang.String path)
Get the value of specified path in the aggregation.- Parameters:
path- the path to the property in the aggregation tree- Returns:
- the value of the property
-
getProperty
public abstract java.lang.Object getProperty(java.util.List<java.lang.String> path)
-
readSize
protected static int readSize(StreamInput in) throws java.io.IOException
Read a size under the assumption that a value of 0 means unlimited.- Throws:
java.io.IOException
-
writeSize
protected static void writeSize(int size, StreamOutput out) throws java.io.IOExceptionWrite a size under the assumption that a value of 0 means unlimited.- Throws:
java.io.IOException
-
getMetaData
public java.util.Map<java.lang.String,java.lang.Object> getMetaData()
Description copied from interface:AggregationGet the optional byte array metadata that was set on the aggregation- Specified by:
getMetaDatain interfaceAggregation
-
pipelineAggregators
public java.util.List<PipelineAggregator> pipelineAggregators()
-
getType
public java.lang.String getType()
- Specified by:
getTypein interfaceAggregation- Returns:
- a string representing the type of the aggregation. This type is added to the aggregation name in the response, so that it can later be used by clients to determine type of the aggregation and parse it into the proper object.
-
toXContent
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
doXContentBody
public abstract XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Throws:
java.io.IOException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-