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
ACompositeValuesSourceBuilder
that builds aRoundingValuesSource
from aScript
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.Params
-
Nested 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
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Modifier Constructor Description DateHistogramValuesSourceBuilder(java.lang.String name)
protected
DateHistogramValuesSourceBuilder(StreamInput in)
-
Method Summary
Modifier and Type Method Description DateHistogramValuesSourceBuilder
calendarInterval(DateHistogramInterval interval)
Sets the interval of the DateHistogram using calendar units (`1d`, `1w`, `1M`, etc).DateHistogramInterval
dateHistogramInterval()
Deprecated.DateHistogramValuesSourceBuilder
dateHistogramInterval(DateHistogramInterval interval)
Deprecated.protected void
doXContentBody(XContentBuilder builder, ToXContent.Params params)
boolean
equals(java.lang.Object obj)
DateHistogramValuesSourceBuilder
fixedInterval(DateHistogramInterval interval)
Sets the interval of the DateHistogram using fixed units (`1ms`, `1s`, `10m`, `4h`, etc).DateHistogramInterval
getIntervalAsCalendar()
Return the interval as a date time unit if applicable, regardless of how it was configured.DateHistogramInterval
getIntervalAsFixed()
Get the interval as aTimeValue
, regardless of how it was configured.int
hashCode()
protected org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceConfig
innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<?> config)
Creates aCompositeValuesSourceConfig
for this source.protected void
innerWriteTo(StreamOutput out)
long
interval()
Deprecated.DateHistogramValuesSourceBuilder
interval(long interval)
Deprecated.java.time.ZoneId
timeZone()
Gets the time zone to use for this aggregationDateHistogramValuesSourceBuilder
timeZone(java.time.ZoneId timeZone)
Sets the time zone to use for this aggregationjava.lang.String
type()
-
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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Constructor Detail
-
DateHistogramValuesSourceBuilder
public DateHistogramValuesSourceBuilder(java.lang.String name)
-
DateHistogramValuesSourceBuilder
protected DateHistogramValuesSourceBuilder(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
innerWriteTo
protected void innerWriteTo(StreamOutput out) throws java.io.IOException
- Specified by:
innerWriteTo
in classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
- Throws:
java.io.IOException
-
doXContentBody
protected void doXContentBody(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
doXContentBody
in classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
- Throws:
java.io.IOException
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in 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:
interval
in interfaceDateIntervalConsumer
-
interval
@Deprecated public DateHistogramValuesSourceBuilder interval(long interval)
Deprecated.Sets the interval on this source. If bothinterval()
anddateHistogramInterval()
are set, then thedateHistogramInterval()
wins.- Specified by:
interval
in interfaceDateIntervalConsumer
- Since:
- 7.2.0
-
dateHistogramInterval
@Deprecated public DateHistogramInterval dateHistogramInterval()
Deprecated.Returns the date interval that is set on this source- Specified by:
dateHistogramInterval
in interfaceDateIntervalConsumer
-
dateHistogramInterval
@Deprecated public DateHistogramValuesSourceBuilder dateHistogramInterval(DateHistogramInterval interval)
Deprecated.- Specified by:
dateHistogramInterval
in interfaceDateIntervalConsumer
- Since:
- 7.2.0
-
calendarInterval
public DateHistogramValuesSourceBuilder calendarInterval(DateHistogramInterval interval)
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:
calendarInterval
in interfaceDateIntervalConsumer
- Parameters:
interval
- The calendar interval to use with the aggregation
-
fixedInterval
public DateHistogramValuesSourceBuilder fixedInterval(DateHistogramInterval interval)
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:
fixedInterval
in interfaceDateIntervalConsumer
- Parameters:
interval
- The fixed interval to use with the aggregation
-
getIntervalAsCalendar
public DateHistogramInterval getIntervalAsCalendar()
Return the interval as a date time unit if applicable, regardless of how it was configured. If this returnsnull
then it means that the interval is expressed as a fixedTimeValue
and may be accessed viagetIntervalAsFixed()
()}.
-
getIntervalAsFixed
public DateHistogramInterval 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
public DateHistogramValuesSourceBuilder timeZone(java.time.ZoneId 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
-
innerBuild
protected org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceConfig innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<?> config) throws java.io.IOException
Description copied from class:CompositeValuesSourceBuilder
Creates aCompositeValuesSourceConfig
for this source.- Specified by:
innerBuild
in classCompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
- Parameters:
queryShardContext
- The shard context for this source.config
- TheValuesSourceConfig
for this source.- Throws:
java.io.IOException
-
-