Class 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 of Aggregation. Serves as a base class for all aggregation implementations.
  • Field Details

    • name

      protected final java.lang.String name
    • metaData

      protected final java.util.Map<java.lang.String,​java.lang.Object> metaData
  • Constructor Details

    • 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.
      name - The name of the get.
    • InternalAggregation

      protected InternalAggregation​(StreamInput in) throws
      Read from a stream.
  • Method Details

    • writeTo

      public final void writeTo​(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
    • doWriteTo

      protected abstract void doWriteTo​(StreamOutput out) throws
    • getName

      public java.lang.String getName()
      Specified by:
      getName in interface Aggregation
      The name of this aggregation.
    • reducePipelines

      public InternalAggregation reducePipelines​(InternalAggregation reducedAggs, InternalAggregation.ReduceContext reduceContext)
      Creates the output from all pipeline aggs that this aggregation is associated with. Should only be called after all aggregations have been fully reduced
    • reduce

      public abstract 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.
    • 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.
      path - the path to the property in the aggregation tree
      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
      Read a size under the assumption that a value of 0 means unlimited.
    • writeSize

      protected static void writeSize​(int size, StreamOutput out) throws
      Write a size under the assumption that a value of 0 means unlimited.
    • getMetaData

      public java.util.Map<java.lang.String,​java.lang.Object> getMetaData()
      Description copied from interface: Aggregation
      Get the optional byte array metadata that was set on the aggregation
      Specified by:
      getMetaData in interface Aggregation
    • pipelineAggregators

      public java.util.List<PipelineAggregator> pipelineAggregators()
    • getType

      public java.lang.String getType()
      Specified by:
      getType in interface Aggregation
      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
      Specified by:
      toXContent in interface ToXContent
    • doXContentBody

      public abstract XContentBuilder doXContentBody​(XContentBuilder builder, ToXContent.Params params) throws
    • hashCode

      public int hashCode()
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      toString in class java.lang.Object