Module org.elasticsearch.server
Class DateIntervalWrapper
java.lang.Object
org.elasticsearch.search.aggregations.bucket.histogram.DateIntervalWrapper
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
A class that handles all the parsing, bwc and deprecations surrounding date histogram intervals.
- Provides parser helpers for the new calendar/fixed interval parameters
- Can write new intervals to old format when streaming out
- Provides a variety of helper methods to interpret the intervals as different types, depending on caller's need
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcalendarInterval(DateHistogramInterval interval) Sets the interval of the DateHistogram using calendar units (`1d`, `1w`, `1M`, etc).createRounding(ZoneId timeZone, long offset) static <T extends DateIntervalConsumer<T>>
voiddeclareIntervalFields(ObjectParser<T, String> parser) booleanvoidfixedInterval(DateHistogramInterval interval) Sets the interval of the DateHistogram using fixed units (`1ms`, `1s`, `10m`, `4h`, etc).Returns the interval as a calendar interval.Returns the interval as a Fixed interval.inthashCode()booleanisEmpty()toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
DateIntervalWrapper
public DateIntervalWrapper() -
DateIntervalWrapper
- Throws:
IOException
-
-
Method Details
-
declareIntervalFields
public static <T extends DateIntervalConsumer<T>> void declareIntervalFields(ObjectParser<T, String> parser) -
getIntervalType
-
getAsCalendarInterval
Returns the interval as a calendar interval. Throws an exception if the value cannot be converted into a calendar interval -
calendarInterval
Sets the interval of the DateHistogram using calendar units (`1d`, `1w`, `1M`, etc). These units are calendar-aware, meaning they respect leap additions, variable days per month, etc. This is mutually exclusive withfixedInterval(DateHistogramInterval)- Parameters:
interval- The fixed interval to use
-
getAsFixedInterval
Returns the interval as a Fixed interval. Throws an exception if the value cannot be converted into a fixed interval -
fixedInterval
Sets the interval of the DateHistogram using fixed units (`1ms`, `1s`, `10m`, `4h`, etc). These are not calendar aware and are simply multiples of fixed, SI units. This is mutually exclusive withcalendarInterval(DateHistogramInterval)- Parameters:
interval- The fixed interval to use
-
createRounding
-
isEmpty
public boolean isEmpty() -
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-