Class DateHistogramValuesSourceBuilder
java.lang.Object
org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
org.elasticsearch.search.aggregations.bucket.composite.DateHistogramValuesSourceBuilder
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment,DateIntervalConsumer
public class DateHistogramValuesSourceBuilder extends CompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder> implements DateIntervalConsumer
A
CompositeValuesSourceBuilder that builds a RoundingValuesSource from a Script or
a field name using the provided interval.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.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 class org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceBuilder
name -
Constructor Summary
Constructors Modifier Constructor Description DateHistogramValuesSourceBuilder(java.lang.String name)protectedDateHistogramValuesSourceBuilder(StreamInput in) -
Method Summary
Modifier and Type Method Description DateHistogramValuesSourceBuildercalendarInterval(DateHistogramInterval interval)Sets the interval of the DateHistogram using calendar units (`1d`, `1w`, `1M`, etc).DateHistogramIntervaldateHistogramInterval()Deprecated.DateHistogramValuesSourceBuilderdateHistogramInterval(DateHistogramInterval interval)Deprecated.protected voiddoXContentBody(XContentBuilder builder, ToXContent.Params params)booleanequals(java.lang.Object obj)DateHistogramValuesSourceBuilderfixedInterval(DateHistogramInterval interval)Sets the interval of the DateHistogram using fixed units (`1ms`, `1s`, `10m`, `4h`, etc).DateHistogramIntervalgetIntervalAsCalendar()Return the interval as a date time unit if applicable, regardless of how it was configured.DateHistogramIntervalgetIntervalAsFixed()Get the interval as aTimeValue, regardless of how it was configured.inthashCode()protected org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceConfiginnerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<?> config)Creates aCompositeValuesSourceConfigfor this source.protected voidinnerWriteTo(StreamOutput out)longinterval()Deprecated.DateHistogramValuesSourceBuilderinterval(long interval)Deprecated.longoffset()Get the offset to use when rounding, which is a number of milliseconds.DateHistogramValuesSourceBuilderoffset(long offset)Set the offset on this builder, which is a number of milliseconds.java.time.ZoneIdtimeZone()Gets the time zone to use for this aggregationDateHistogramValuesSourceBuildertimeZone(java.time.ZoneId timeZone)Sets the time zone to use for this aggregationjava.lang.Stringtype()Methods inherited from class org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceBuilder
build, field, field, format, format, missingBucket, missingBucket, name, order, order, order, script, script, toXContent, valueType, valueType, writeTo
-
Constructor Details
-
DateHistogramValuesSourceBuilder
public DateHistogramValuesSourceBuilder(java.lang.String name) -
DateHistogramValuesSourceBuilder
- Throws:
java.io.IOException
-
-
Method Details
-
innerWriteTo
- Specified by:
innerWriteToin classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>- Throws:
java.io.IOException
-
doXContentBody
protected void doXContentBody(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
doXContentBodyin classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>- Throws:
java.io.IOException
-
hashCode
public int hashCode()- Overrides:
hashCodein classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
-
type
public java.lang.String type() -
interval
@Deprecated public long interval()Deprecated.Returns the interval in milliseconds that is set on this source- Specified by:
intervalin interfaceDateIntervalConsumer
-
interval
Deprecated.Sets the interval on this source. If bothinterval()anddateHistogramInterval()are set, then thedateHistogramInterval()wins.- Specified by:
intervalin interfaceDateIntervalConsumer- Since:
- 7.2.0
-
dateHistogramInterval
Deprecated.Returns the date interval that is set on this source- Specified by:
dateHistogramIntervalin interfaceDateIntervalConsumer
-
dateHistogramInterval
@Deprecated public DateHistogramValuesSourceBuilder dateHistogramInterval(DateHistogramInterval interval)Deprecated.- Specified by:
dateHistogramIntervalin interfaceDateIntervalConsumer- Since:
- 7.2.0
-
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)- Specified by:
calendarIntervalin interfaceDateIntervalConsumer- Parameters:
interval- The calendar interval to use with the aggregation
-
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)- Specified by:
fixedIntervalin interfaceDateIntervalConsumer- Parameters:
interval- The fixed interval to use with the aggregation
-
getIntervalAsCalendar
Return the interval as a date time unit if applicable, regardless of how it was configured. If this returnsnullthen it means that the interval is expressed as a fixedTimeValueand may be accessed viagetIntervalAsFixed()()}. -
getIntervalAsFixed
Get the interval as aTimeValue, regardless of how it was configured. Returns null if the interval cannot be parsed as a fixed time. -
timeZone
Sets the time zone to use for this aggregation -
timeZone
public java.time.ZoneId timeZone()Gets the time zone to use for this aggregation- Overrides:
timeZonein classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
-
offset
public long offset()Get the offset to use when rounding, which is a number of milliseconds. -
offset
Set the offset on this builder, which is a number of milliseconds.- Returns:
- this for chaining
-
innerBuild
protected org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceConfig innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<?> config) throws java.io.IOExceptionDescription copied from class:CompositeValuesSourceBuilderCreates aCompositeValuesSourceConfigfor this source.- Specified by:
innerBuildin classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>- Parameters:
queryShardContext- The shard context for this source.config- TheValuesSourceConfigfor this source.- Throws:
java.io.IOException
-