Class InternalStats

All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment, Aggregation, NumericMetricsAggregation, NumericMetricsAggregation.MultiValue, Stats
Direct Known Subclasses:
InternalExtendedStats, InternalStatsBucket

public class InternalStats
extends InternalNumericMetricsAggregation.MultiValue
implements Stats
  • Field Details

    • count

      protected final long count
    • min

      protected final double min
    • max

      protected final double max
    • sum

      protected final double sum
  • Constructor Details

    • InternalStats

      public InternalStats​(java.lang.String name, long count, double sum, double min, double max, DocValueFormat formatter, java.util.Map<java.lang.String,​java.lang.Object> metadata)
    • InternalStats

      public InternalStats​(StreamInput in) throws java.io.IOException
      Read from a stream.
      Throws:
      java.io.IOException
  • Method Details

    • doWriteTo

      protected final void doWriteTo​(StreamOutput out) throws java.io.IOException
      Specified by:
      doWriteTo in class InternalAggregation
      Throws:
      java.io.IOException
    • writeOtherStatsTo

      protected void writeOtherStatsTo​(StreamOutput out) throws java.io.IOException
      Throws:
      java.io.IOException
    • getWriteableName

      public java.lang.String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
      Specified by:
      getWriteableName in interface NamedWriteable
    • getCount

      public long getCount()
      Specified by:
      getCount in interface Stats
      Returns:
      The number of values that were aggregated.
    • getMin

      public double getMin()
      Specified by:
      getMin in interface Stats
      Returns:
      The minimum value of all aggregated values.
    • getMax

      public double getMax()
      Specified by:
      getMax in interface Stats
      Returns:
      The maximum value of all aggregated values.
    • getAvg

      public double getAvg()
      Specified by:
      getAvg in interface Stats
      Returns:
      The avg value over all aggregated values.
    • getSum

      public double getSum()
      Specified by:
      getSum in interface Stats
      Returns:
      The sum of aggregated values.
    • getMinAsString

      public java.lang.String getMinAsString()
      Specified by:
      getMinAsString in interface Stats
      Returns:
      The minimum value of all aggregated values as a String.
    • getMaxAsString

      public java.lang.String getMaxAsString()
      Specified by:
      getMaxAsString in interface Stats
      Returns:
      The maximum value of all aggregated values as a String.
    • getAvgAsString

      public java.lang.String getAvgAsString()
      Specified by:
      getAvgAsString in interface Stats
      Returns:
      The avg value over all aggregated values as a String.
    • getSumAsString

      public java.lang.String getSumAsString()
      Specified by:
      getSumAsString in interface Stats
      Returns:
      The sum of aggregated values as a String.
    • value

      public double value​(java.lang.String name)
      Description copied from interface: NumericMetricsAggregation.MultiValue
      Return the result of 1 value by name
      Specified by:
      value in interface NumericMetricsAggregation.MultiValue
      Specified by:
      value in class InternalNumericMetricsAggregation.MultiValue
      Parameters:
      name - of the value
      Returns:
      the value
    • valueNames

      public java.lang.Iterable<java.lang.String> valueNames()
      Description copied from interface: NumericMetricsAggregation.MultiValue
      Return an iterable over all value names this multi value aggregation provides. The iterable might be created on the fly, if you need to call this multiple times, please cache the result in a variable on caller side..
      Specified by:
      valueNames in interface NumericMetricsAggregation.MultiValue
      Returns:
      iterable over all value names
    • reduce

      public InternalStats reduce​(java.util.List<InternalAggregation> aggregations, InternalAggregation.ReduceContext reduceContext)
      Description copied from class: InternalAggregation
      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.
      Specified by:
      reduce in class InternalAggregation
      See Also:
      InternalAggregation.mustReduceOnSingleInternalAgg()
    • doXContentBody

      public org.elasticsearch.common.xcontent.XContentBuilder doXContentBody​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      doXContentBody in class InternalAggregation
      Throws:
      java.io.IOException
    • otherStatsToXContent

      protected org.elasticsearch.common.xcontent.XContentBuilder otherStatsToXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class InternalNumericMetricsAggregation
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class InternalNumericMetricsAggregation