Class DateHistogramInterval

All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class DateHistogramInterval
extends java.lang.Object
implements Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
The interval the date histogram is based on.
  • Field Details

  • Constructor Details

    • DateHistogramInterval

      public DateHistogramInterval​(java.lang.String expression)
    • DateHistogramInterval

      public DateHistogramInterval​(StreamInput in) throws
      Read from a stream.
  • Method Details

    • seconds

      public static DateHistogramInterval seconds​(int sec)
    • minutes

      public static DateHistogramInterval minutes​(int min)
    • hours

      public static DateHistogramInterval hours​(int hours)
    • days

      public static DateHistogramInterval days​(int days)
    • weeks

      public static DateHistogramInterval weeks​(int weeks)
    • writeTo

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

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

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

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

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
    • estimateMillis

      public long estimateMillis()
      Converts this DateHistogramInterval into a millisecond representation. If this is a calendar interval, it is an approximation of milliseconds based on the fixed equivalent (e.g. `1h` is treated as 60 fixed minutes, rather than the hour at a specific point in time. This is merely a convenience helper for quick comparisons and should not be used for situations that require precise durations.