Class DateHistogramInterval
java.lang.Object
org.elasticsearch.search.aggregations.bucket.histogram.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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested 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 static DateHistogramIntervalDAYstatic DateHistogramIntervalHOURstatic DateHistogramIntervalMINUTEstatic DateHistogramIntervalMONTHstatic DateHistogramIntervalQUARTERstatic DateHistogramIntervalSECONDstatic DateHistogramIntervalWEEKstatic DateHistogramIntervalYEAR -
Constructor Summary
Constructors Constructor Description DateHistogramInterval(java.lang.String expression)DateHistogramInterval(StreamInput in)Read from a stream. -
Method Summary
Modifier and Type Method Description static DateHistogramIntervaldays(int days)booleanequals(java.lang.Object obj)longestimateMillis()Converts this DateHistogramInterval into a millisecond representation.inthashCode()static DateHistogramIntervalhours(int hours)static DateHistogramIntervalminutes(int min)static DateHistogramIntervalseconds(int sec)java.lang.StringtoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)static DateHistogramIntervalweeks(int weeks)voidwriteTo(StreamOutput out)Write this into the StreamOutput.
-
Field Details
-
Constructor Details
-
DateHistogramInterval
public DateHistogramInterval(java.lang.String expression) -
DateHistogramInterval
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
seconds
-
minutes
-
hours
-
days
-
weeks
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
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.
-