Class DateRangeAggregationBuilder
- java.lang.Object
-
- org.elasticsearch.search.aggregations.AggregationBuilder
-
- org.elasticsearch.search.aggregations.AbstractAggregationBuilder<AB>
-
- org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder<ValuesSource.Numeric,AB>
-
- org.elasticsearch.search.aggregations.bucket.range.AbstractRangeBuilder<DateRangeAggregationBuilder,RangeAggregator.Range>
-
- org.elasticsearch.search.aggregations.bucket.range.DateRangeAggregationBuilder
-
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentFragment
,BaseAggregationBuilder
,MultiBucketAggregationBuilder
public class DateRangeAggregationBuilder extends AbstractRangeBuilder<DateRangeAggregationBuilder,RangeAggregator.Range>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder
ValuesSourceAggregationBuilder.LeafOnly<VS extends ValuesSource,AB extends ValuesSourceAggregationBuilder<VS,AB>>
-
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
AggregationBuilder.CommonFields
-
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 Modifier and Type Field Description static java.lang.String
NAME
-
Fields inherited from class org.elasticsearch.search.aggregations.bucket.range.AbstractRangeBuilder
keyed, rangeFactory, ranges
-
Fields inherited from class org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder
config
-
Fields inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
metaData
-
Fields inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
factoriesBuilder, name
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Modifier Constructor Description DateRangeAggregationBuilder(java.lang.String name)
DateRangeAggregationBuilder(StreamInput in)
Read from a stream.protected
DateRangeAggregationBuilder(DateRangeAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
-
Method Summary
Modifier and Type Method Description DateRangeAggregationBuilder
addRange(double from, double to)
Same asaddRange(String, double, double)
but the key will be automatically generated based onfrom
andto
.DateRangeAggregationBuilder
addRange(java.lang.String key, double from, double to)
Add a new range to this aggregation.DateRangeAggregationBuilder
addRange(java.lang.String from, java.lang.String to)
Same asaddRange(String, String, String)
but the key will be automatically generated based onfrom
andto
.DateRangeAggregationBuilder
addRange(java.lang.String key, java.lang.String from, java.lang.String to)
Add a new range to this aggregation.DateRangeAggregationBuilder
addRange(java.lang.String key, org.joda.time.DateTime from, org.joda.time.DateTime to)
Add a new range to this aggregation.DateRangeAggregationBuilder
addRange(org.joda.time.DateTime from, org.joda.time.DateTime to)
Same asaddRange(String, DateTime, DateTime)
but the key will be automatically generated based onfrom
andto
.DateRangeAggregationBuilder
addUnboundedFrom(double from)
Same asaddUnboundedFrom(String, double)
but the key will be computed automatically.DateRangeAggregationBuilder
addUnboundedFrom(java.lang.String from)
Same asaddUnboundedFrom(String, String)
but the key will be computed automatically.DateRangeAggregationBuilder
addUnboundedFrom(java.lang.String key, double from)
Add a new range with no upper bound.DateRangeAggregationBuilder
addUnboundedFrom(java.lang.String key, java.lang.String from)
Add a new range with no upper bound.DateRangeAggregationBuilder
addUnboundedFrom(java.lang.String key, org.joda.time.DateTime from)
Add a new range with no upper bound.DateRangeAggregationBuilder
addUnboundedFrom(org.joda.time.DateTime from)
Same asaddUnboundedFrom(String, DateTime)
but the key will be computed automatically.DateRangeAggregationBuilder
addUnboundedTo(double to)
Same asaddUnboundedTo(String, double)
but the key will be computed automatically.DateRangeAggregationBuilder
addUnboundedTo(java.lang.String to)
Same asaddUnboundedTo(String, String)
but the key will be computed automatically.DateRangeAggregationBuilder
addUnboundedTo(java.lang.String key, double to)
Add a new range with no lower bound.DateRangeAggregationBuilder
addUnboundedTo(java.lang.String key, java.lang.String to)
Add a new range with no lower bound.DateRangeAggregationBuilder
addUnboundedTo(java.lang.String key, org.joda.time.DateTime to)
Add a new range with no lower bound.DateRangeAggregationBuilder
addUnboundedTo(org.joda.time.DateTime to)
Same asaddUnboundedTo(String, DateTime)
but the key will be computed automatically.java.lang.String
getType()
The name of the type of aggregation built by this builder.protected DateRangeAggregatorFactory
innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.Numeric> config, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder)
static AggregationBuilder
parse(java.lang.String aggregationName, XContentParser parser)
protected AggregationBuilder
shallowCopy(AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
Create a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilder
andmetaData
.-
Methods inherited from class org.elasticsearch.search.aggregations.bucket.range.AbstractRangeBuilder
addRange, doXContentBody, innerEquals, innerHashCode, innerWriteTo, keyed, keyed, processRanges, ranges
-
Methods inherited from class org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder
doBuild, doEquals, doHashCode, doWriteTo, field, field, format, format, internalXContent, missing, missing, resolveConfig, script, script, serializeTargetValueType, timeZone, timeZone, valueType, valueType
-
Methods inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
build, equals, getMetaData, getWriteableName, hashCode, setMetaData, subAggregation, subAggregation, subAggregations, toXContent, writeTo
-
Methods inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
doRewrite, getName, getPipelineAggregations, getSubAggregations, rewrite, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DateRangeAggregationBuilder
public DateRangeAggregationBuilder(java.lang.String name)
-
DateRangeAggregationBuilder
protected DateRangeAggregationBuilder(DateRangeAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
-
DateRangeAggregationBuilder
public DateRangeAggregationBuilder(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
-
Method Detail
-
parse
public static AggregationBuilder parse(java.lang.String aggregationName, XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
shallowCopy
protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
Description copied from class:AggregationBuilder
Create a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilder
andmetaData
. Used byAggregationBuilder.rewrite(QueryRewriteContext)
.- Specified by:
shallowCopy
in classAggregationBuilder
-
getType
public java.lang.String getType()
Description copied from interface:BaseAggregationBuilder
The name of the type of aggregation built by this builder.
-
addRange
public DateRangeAggregationBuilder addRange(java.lang.String key, java.lang.String from, java.lang.String to)
Add a new range to this aggregation.- Parameters:
key
- the key to use for this range in the responsefrom
- the lower bound on the dates, inclusiveto
- the upper bound on the dates, exclusive
-
addRange
public DateRangeAggregationBuilder addRange(java.lang.String from, java.lang.String to)
Same asaddRange(String, String, String)
but the key will be automatically generated based onfrom
andto
.
-
addUnboundedTo
public DateRangeAggregationBuilder addUnboundedTo(java.lang.String key, java.lang.String to)
Add a new range with no lower bound.- Parameters:
key
- the key to use for this range in the responseto
- the upper bound on the dates, exclusive
-
addUnboundedTo
public DateRangeAggregationBuilder addUnboundedTo(java.lang.String to)
Same asaddUnboundedTo(String, String)
but the key will be computed automatically.
-
addUnboundedFrom
public DateRangeAggregationBuilder addUnboundedFrom(java.lang.String key, java.lang.String from)
Add a new range with no upper bound.- Parameters:
key
- the key to use for this range in the responsefrom
- the lower bound on the distances, inclusive
-
addUnboundedFrom
public DateRangeAggregationBuilder addUnboundedFrom(java.lang.String from)
Same asaddUnboundedFrom(String, String)
but the key will be computed automatically.
-
addRange
public DateRangeAggregationBuilder addRange(java.lang.String key, double from, double to)
Add a new range to this aggregation.- Parameters:
key
- the key to use for this range in the responsefrom
- the lower bound on the dates, inclusiveto
- the upper bound on the dates, exclusive
-
addRange
public DateRangeAggregationBuilder addRange(double from, double to)
Same asaddRange(String, double, double)
but the key will be automatically generated based onfrom
andto
.
-
addUnboundedTo
public DateRangeAggregationBuilder addUnboundedTo(java.lang.String key, double to)
Add a new range with no lower bound.- Parameters:
key
- the key to use for this range in the responseto
- the upper bound on the dates, exclusive
-
addUnboundedTo
public DateRangeAggregationBuilder addUnboundedTo(double to)
Same asaddUnboundedTo(String, double)
but the key will be computed automatically.
-
addUnboundedFrom
public DateRangeAggregationBuilder addUnboundedFrom(java.lang.String key, double from)
Add a new range with no upper bound.- Parameters:
key
- the key to use for this range in the responsefrom
- the lower bound on the distances, inclusive
-
addUnboundedFrom
public DateRangeAggregationBuilder addUnboundedFrom(double from)
Same asaddUnboundedFrom(String, double)
but the key will be computed automatically.
-
addRange
public DateRangeAggregationBuilder addRange(java.lang.String key, org.joda.time.DateTime from, org.joda.time.DateTime to)
Add a new range to this aggregation.- Parameters:
key
- the key to use for this range in the responsefrom
- the lower bound on the dates, inclusiveto
- the upper bound on the dates, exclusive
-
addRange
public DateRangeAggregationBuilder addRange(org.joda.time.DateTime from, org.joda.time.DateTime to)
Same asaddRange(String, DateTime, DateTime)
but the key will be automatically generated based onfrom
andto
.
-
addUnboundedTo
public DateRangeAggregationBuilder addUnboundedTo(java.lang.String key, org.joda.time.DateTime to)
Add a new range with no lower bound.- Parameters:
key
- the key to use for this range in the responseto
- the upper bound on the dates, exclusive
-
addUnboundedTo
public DateRangeAggregationBuilder addUnboundedTo(org.joda.time.DateTime to)
Same asaddUnboundedTo(String, DateTime)
but the key will be computed automatically.
-
addUnboundedFrom
public DateRangeAggregationBuilder addUnboundedFrom(java.lang.String key, org.joda.time.DateTime from)
Add a new range with no upper bound.- Parameters:
key
- the key to use for this range in the responsefrom
- the lower bound on the distances, inclusive
-
addUnboundedFrom
public DateRangeAggregationBuilder addUnboundedFrom(org.joda.time.DateTime from)
Same asaddUnboundedFrom(String, DateTime)
but the key will be computed automatically.
-
innerBuild
protected DateRangeAggregatorFactory innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.Numeric> config, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder) throws java.io.IOException
- Specified by:
innerBuild
in classValuesSourceAggregationBuilder<ValuesSource.Numeric,DateRangeAggregationBuilder>
- Throws:
java.io.IOException
-
-