Class HistogramAggregationBuilder
- java.lang.Object
-
- org.elasticsearch.search.aggregations.AggregationBuilder
-
- org.elasticsearch.search.aggregations.AbstractAggregationBuilder<AB>
-
- org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder>
-
- org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregationBuilder
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentFragment,BaseAggregationBuilder,MultiBucketAggregationBuilder
public class HistogramAggregationBuilder extends ValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder> implements MultiBucketAggregationBuilder
A builder for histograms on numeric fields.
-
-
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.StringNAME-
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 HistogramAggregationBuilder(java.lang.String name)Create a new builder with the given name.HistogramAggregationBuilder(StreamInput in)Read from a stream, for internal use only.protectedHistogramAggregationBuilder(HistogramAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
-
Method Summary
Modifier and Type Method Description protected XContentBuilderdoXContentBody(XContentBuilder builder, ToXContent.Params params)HistogramAggregationBuilderextendedBounds(double minBound, double maxBound)Set extended bounds on this builder: buckets betweenminBoundandmaxBoundwill be created even if no documents fell into these buckets.java.lang.StringgetType()The name of the type of aggregation built by this builder.protected ValuesSourceAggregatorFactory<ValuesSource.Numeric,?>innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.Numeric> config, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder)protected booleaninnerEquals(java.lang.Object obj)protected intinnerHashCode()protected voidinnerWriteTo(StreamOutput out)Write subclass's state to the stream.doubleinterval()Get the current interval that is set on this builder.HistogramAggregationBuilderinterval(double interval)Set the interval on this builder, and return the builder so that calls can be chained.booleankeyed()Return whether buckets should be returned as a hash.HistogramAggregationBuilderkeyed(boolean keyed)Set whether to return buckets as a hash or as an array, and return the builder so that calls can be chained.doublemaxBound()Get the current maximum bound that is set on this builder.doubleminBound()Get the current minimum bound that is set on this builder.longminDocCount()Return the minimum count of documents that buckets need to have in order to be included in the response.HistogramAggregationBuilderminDocCount(long minDocCount)Set the minimum count of matching documents that buckets need to have and return this builder so that calls can be chained.doubleoffset()Get the current offset that is set on this builder.HistogramAggregationBuilderoffset(double offset)Set the offset on this builder, and return the builder so that calls can be chained.BucketOrderorder()Return the order to use to sort buckets of this histogram.HistogramAggregationBuilderorder(java.util.List<BucketOrder> orders)Sets the order in which the buckets will be returned.HistogramAggregationBuilderorder(BucketOrder order)Set a new order on this builder and return the builder so that calls can be chained.static HistogramAggregationBuilderparse(java.lang.String aggregationName, XContentParser parser)protected AggregationBuildershallowCopy(AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)Create a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilderandmetaData.-
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
-
HistogramAggregationBuilder
public HistogramAggregationBuilder(java.lang.String name)
Create a new builder with the given name.
-
HistogramAggregationBuilder
protected HistogramAggregationBuilder(HistogramAggregationBuilder clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
-
HistogramAggregationBuilder
public HistogramAggregationBuilder(StreamInput in) throws java.io.IOException
Read from a stream, for internal use only.- Throws:
java.io.IOException
-
-
Method Detail
-
parse
public static HistogramAggregationBuilder 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:AggregationBuilderCreate a shallow copy of this builder and replacingAggregationBuilder.factoriesBuilderandmetaData. Used byAggregationBuilder.rewrite(QueryRewriteContext).- Specified by:
shallowCopyin classAggregationBuilder
-
innerWriteTo
protected void innerWriteTo(StreamOutput out) throws java.io.IOException
Description copied from class:ValuesSourceAggregationBuilderWrite subclass's state to the stream.- Specified by:
innerWriteToin classValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder>- Throws:
java.io.IOException
-
interval
public double interval()
Get the current interval that is set on this builder.
-
interval
public HistogramAggregationBuilder interval(double interval)
Set the interval on this builder, and return the builder so that calls can be chained.
-
offset
public double offset()
Get the current offset that is set on this builder.
-
offset
public HistogramAggregationBuilder offset(double offset)
Set the offset on this builder, and return the builder so that calls can be chained.
-
minBound
public double minBound()
Get the current minimum bound that is set on this builder.
-
maxBound
public double maxBound()
Get the current maximum bound that is set on this builder.
-
extendedBounds
public HistogramAggregationBuilder extendedBounds(double minBound, double maxBound)
Set extended bounds on this builder: buckets betweenminBoundandmaxBoundwill be created even if no documents fell into these buckets.- Throws:
java.lang.IllegalArgumentException- if maxBound is less that minBound, or if either of the bounds are not finite.
-
order
public BucketOrder order()
Return the order to use to sort buckets of this histogram.
-
order
public HistogramAggregationBuilder order(BucketOrder order)
Set a new order on this builder and return the builder so that calls can be chained. A tie-breaker may be added to avoid non-deterministic ordering.
-
order
public HistogramAggregationBuilder order(java.util.List<BucketOrder> orders)
Sets the order in which the buckets will be returned. A tie-breaker may be added to avoid non-deterministic ordering.
-
keyed
public boolean keyed()
Return whether buckets should be returned as a hash. In casekeyedis false, buckets will be returned as an array.
-
keyed
public HistogramAggregationBuilder keyed(boolean keyed)
Set whether to return buckets as a hash or as an array, and return the builder so that calls can be chained.
-
minDocCount
public long minDocCount()
Return the minimum count of documents that buckets need to have in order to be included in the response.
-
minDocCount
public HistogramAggregationBuilder minDocCount(long minDocCount)
Set the minimum count of matching documents that buckets need to have and return this builder so that calls can be chained.
-
doXContentBody
protected XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
doXContentBodyin classValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder>- Throws:
java.io.IOException
-
getType
public java.lang.String getType()
Description copied from interface:BaseAggregationBuilderThe name of the type of aggregation built by this builder.- Specified by:
getTypein interfaceBaseAggregationBuilder
-
innerBuild
protected ValuesSourceAggregatorFactory<ValuesSource.Numeric,?> innerBuild(SearchContext context, ValuesSourceConfig<ValuesSource.Numeric> config, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder) throws java.io.IOException
- Specified by:
innerBuildin classValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder>- Throws:
java.io.IOException
-
innerHashCode
protected int innerHashCode()
- Specified by:
innerHashCodein classValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder>
-
innerEquals
protected boolean innerEquals(java.lang.Object obj)
- Specified by:
innerEqualsin classValuesSourceAggregationBuilder<ValuesSource.Numeric,HistogramAggregationBuilder>
-
-