Class ValuesSourceAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
java.lang.Object
org.elasticsearch.search.aggregations.AggregationBuilder
org.elasticsearch.search.aggregations.AbstractAggregationBuilder<AB>
org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder<AB>
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
,BaseAggregationBuilder
- Direct Known Subclasses:
AbstractRangeBuilder
,AutoDateHistogramAggregationBuilder
,DateHistogramAggregationBuilder
,DiversifiedAggregationBuilder
,GeoBoundsAggregationBuilder
,GeoDistanceAggregationBuilder
,GeoGridAggregationBuilder
,HistogramAggregationBuilder
,IpRangeAggregationBuilder
,MissingAggregationBuilder
,RareTermsAggregationBuilder
,SignificantTermsAggregationBuilder
,TermsAggregationBuilder
,ValuesSourceAggregationBuilder.LeafOnly
public abstract class ValuesSourceAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>> extends AbstractAggregationBuilder<AB>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ValuesSourceAggregationBuilder.LeafOnly<VS extends ValuesSource,AB extends ValuesSourceAggregationBuilder<AB>>
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
AggregationBuilder.BucketCardinality, AggregationBuilder.CommonFields
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.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 protected ValuesSourceConfig
config
Fields inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
metadata
Fields inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
factoriesBuilder, name
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValuesSourceAggregationBuilder(java.lang.String name)
protected
ValuesSourceAggregationBuilder(StreamInput in)
Read from a stream.protected
ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<AB> clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metadata)
-
Method Summary
Modifier and Type Method Description static <T> void
declareFields(org.elasticsearch.common.xcontent.AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>,T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware)
protected abstract ValuesSourceType
defaultValueSourceType()
Aggregations should use this method to define aValuesSourceType
of last resort.protected ValuesSourceAggregatorFactory
doBuild(QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder)
protected void
doWriteTo(StreamOutput out)
protected abstract org.elasticsearch.common.xcontent.XContentBuilder
doXContentBody(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
boolean
equals(java.lang.Object obj)
java.lang.String
field()
Gets the field to use for this aggregation.AB
field(java.lang.String field)
Sets the field to use for this aggregation.java.lang.String
format()
Gets the format to use for the output of the aggregation.AB
format(java.lang.String format)
Sets the format to use for the output of the aggregation.int
hashCode()
protected abstract ValuesSourceAggregatorFactory
innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder)
protected abstract void
innerWriteTo(StreamOutput out)
Write subclass's state to the stream.org.elasticsearch.common.xcontent.XContentBuilder
internalXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
java.lang.Object
missing()
Gets the value to use when the aggregation finds a missing value in a documentAB
missing(java.lang.Object missing)
Sets the value to use when the aggregation finds a missing value in a documentprotected ValuesSourceConfig
resolveConfig(QueryShardContext queryShardContext)
Script
script()
Gets the script to use for this aggregation.AB
script(Script script)
Sets the script to use for this aggregation.protected boolean
serializeTargetValueType(Version version)
DO NOT OVERRIDE THIS! This method only exists for legacy support.java.time.ZoneId
timeZone()
Gets the time zone to use for this aggregationAB
timeZone(java.time.ZoneId timeZone)
Sets the time zone to use for this aggregationValueType
userValueTypeHint()
AB
userValueTypeHint(ValueType valueType)
This setter should only be used during parsing, to set the userValueTypeHint.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
bucketCardinality, buildPipelineTree, doRewrite, getName, getPipelineAggregations, getSubAggregations, rewrite, shallowCopy, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.search.aggregations.BaseAggregationBuilder
getType
-
Field Details
-
Constructor Details
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(java.lang.String name) -
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<AB> clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metadata) -
ValuesSourceAggregationBuilder
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
declareFields
public static <T> void declareFields(org.elasticsearch.common.xcontent.AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>,T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware) -
doWriteTo
- Specified by:
doWriteTo
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
- Throws:
java.io.IOException
-
innerWriteTo
Write subclass's state to the stream.- Throws:
java.io.IOException
-
serializeTargetValueType
DO NOT OVERRIDE THIS! This method only exists for legacy support. No new aggregations need this, nor should they override it.- Parameters:
version
- For backwards compatibility, subclasses can change behavior based on the version
-
field
Sets the field to use for this aggregation. -
field
public java.lang.String field()Gets the field to use for this aggregation. -
script
Sets the script to use for this aggregation. -
script
Gets the script to use for this aggregation. -
userValueTypeHint
This setter should only be used during parsing, to set the userValueTypeHint. This is information the user provides in the json query to indicate the output type of a script or the type of the 'missing' replacement value.- Parameters:
valueType
- - The parsedValueType
based on the string the user specified- Returns:
- - The modified builder instance, for chaining.
-
userValueTypeHint
-
format
Sets the format to use for the output of the aggregation. -
format
public java.lang.String format()Gets the format to use for the output of the aggregation. -
missing
Sets the value to use when the aggregation finds a missing value in a document -
missing
public java.lang.Object missing()Gets the value to use when the aggregation finds a missing value in a document -
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 -
doBuild
protected final ValuesSourceAggregatorFactory doBuild(QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws java.io.IOException- Specified by:
doBuild
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
- Throws:
java.io.IOException
-
defaultValueSourceType
Aggregations should use this method to define aValuesSourceType
of last resort. This will only be used when the resolver can't find a field and the user hasn't provided a value type hint.- Returns:
- The CoreValuesSourceType we expect this script to yield.
-
resolveConfig
-
innerBuild
protected abstract ValuesSourceAggregatorFactory innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws java.io.IOException- Throws:
java.io.IOException
-
internalXContent
public final org.elasticsearch.common.xcontent.XContentBuilder internalXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
internalXContent
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
- Throws:
java.io.IOException
-
doXContentBody
protected abstract org.elasticsearch.common.xcontent.XContentBuilder doXContentBody(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
-