Class RangeAggregationBuilder
- 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<RangeAggregationBuilder,RangeAggregator.Range>
-
- org.elasticsearch.search.aggregations.bucket.range.RangeAggregationBuilder
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment,BaseAggregationBuilder,MultiBucketAggregationBuilder
public class RangeAggregationBuilder extends AbstractRangeBuilder<RangeAggregationBuilder,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 StringNAME-
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 RangeAggregationBuilder(String name)RangeAggregationBuilder(StreamInput in)Read from a stream.protectedRangeAggregationBuilder(RangeAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metaData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RangeAggregationBuilderaddRange(double from, double to)Same asaddRange(String, double, double)but the key will be automatically generated based onfromandto.RangeAggregationBuilderaddRange(String key, double from, double to)Add a new range to this aggregation.RangeAggregationBuilderaddUnboundedFrom(double from)Same asaddUnboundedFrom(String, double)but the key will be computed automatically.RangeAggregationBuilderaddUnboundedFrom(String key, double from)Add a new range with no upper bound.RangeAggregationBuilderaddUnboundedTo(double to)Same asaddUnboundedTo(String, double)but the key will be computed automatically.RangeAggregationBuilderaddUnboundedTo(String key, double to)Add a new range with no lower bound.StringgetType()The name of the type of aggregation built by this builder.protected RangeAggregatorFactoryinnerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<ValuesSource.Numeric> config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder)static AggregationBuilderparse(String aggregationName, XContentParser parser)protected AggregationBuildershallowCopy(AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metaData)Create a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilderandmetaData.-
Methods inherited from class org.elasticsearch.search.aggregations.bucket.range.AbstractRangeBuilder
addRange, doXContentBody, equals, hashCode, innerWriteTo, keyed, keyed, processRanges, ranges
-
Methods inherited from class org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder
defaultValueType, doBuild, doWriteTo, field, field, format, format, internalXContent, missing, missing, resolveConfig, resolveScriptAny, script, script, serializeTargetValueType, timeZone, timeZone, valueType, valueType
-
Methods inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
build, getMetaData, getWriteableName, 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 String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RangeAggregationBuilder
public RangeAggregationBuilder(String name)
-
RangeAggregationBuilder
public RangeAggregationBuilder(StreamInput in) throws IOException
Read from a stream.- Throws:
IOException
-
RangeAggregationBuilder
protected RangeAggregationBuilder(RangeAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metaData)
-
-
Method Detail
-
parse
public static AggregationBuilder parse(String aggregationName, XContentParser parser) throws IOException
- Throws:
IOException
-
shallowCopy
protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metaData)
Description copied from class:AggregationBuilderCreate a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilderandmetaData. Used byAggregationBuilder.rewrite(QueryRewriteContext).- Specified by:
shallowCopyin classAggregationBuilder
-
addRange
public RangeAggregationBuilder addRange(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 distances, inclusiveto- the upper bound on the distances, exclusive
-
addRange
public RangeAggregationBuilder addRange(double from, double to)
Same asaddRange(String, double, double)but the key will be automatically generated based onfromandto.
-
addUnboundedTo
public RangeAggregationBuilder addUnboundedTo(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 distances, exclusive
-
addUnboundedTo
public RangeAggregationBuilder addUnboundedTo(double to)
Same asaddUnboundedTo(String, double)but the key will be computed automatically.
-
addUnboundedFrom
public RangeAggregationBuilder addUnboundedFrom(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 RangeAggregationBuilder addUnboundedFrom(double from)
Same asaddUnboundedFrom(String, double)but the key will be computed automatically.
-
innerBuild
protected RangeAggregatorFactory innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<ValuesSource.Numeric> config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException
- Specified by:
innerBuildin classValuesSourceAggregationBuilder<ValuesSource.Numeric,RangeAggregationBuilder>- Throws:
IOException
-
getType
public String getType()
Description copied from interface:BaseAggregationBuilderThe name of the type of aggregation built by this builder.
-
-