Class ValuesSourceAggregationBuilder<VS extends ValuesSource,AB extends ValuesSourceAggregationBuilder<VS,AB>>
java.lang.Object
org.elasticsearch.search.aggregations.AggregationBuilder
org.elasticsearch.search.aggregations.AbstractAggregationBuilder<AB>
org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder<VS,AB>
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentFragment
,BaseAggregationBuilder
- Direct Known Subclasses:
AbstractRangeBuilder
,AutoDateHistogramAggregationBuilder
,DateHistogramAggregationBuilder
,DiversifiedAggregationBuilder
,GeoBoundsAggregationBuilder
,GeoDistanceAggregationBuilder
,GeoGridAggregationBuilder
,HistogramAggregationBuilder
,IpRangeAggregationBuilder
,MissingAggregationBuilder
,RareTermsAggregationBuilder
,SignificantTermsAggregationBuilder
,TermsAggregationBuilder
,ValuesSourceAggregationBuilder.LeafOnly
public abstract class ValuesSourceAggregationBuilder<VS extends ValuesSource,AB extends ValuesSourceAggregationBuilder<VS,AB>> extends AbstractAggregationBuilder<AB>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
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 protected ValuesSourceConfig<VS>
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, ValuesSourceType valuesSourceType, ValueType targetValueType)
protected
ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType)
Read an aggregation from a stream that serializes its targetValueType.protected
ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType, ValueType targetValueType)
Read an aggregation from a stream that has a sensible default for TargetValueType.protected
ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<VS,AB> clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData)
-
Method Summary
Modifier and Type Method Description protected ValueType
defaultValueType(Script script)
Provide a hook for aggregations to have finer grained control of the ValueType for script values.protected ValuesSourceAggregatorFactory<VS>
doBuild(QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder)
protected void
doWriteTo(StreamOutput out)
protected abstract XContentBuilder
doXContentBody(XContentBuilder builder, 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<VS>
innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<VS> config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder)
protected abstract void
innerWriteTo(StreamOutput out)
Write subclass's state to the stream.XContentBuilder
internalXContent(XContentBuilder builder, 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<VS>
resolveConfig(QueryShardContext queryShardContext)
protected ValuesSourceType
resolveScriptAny(Script script)
Provide a hook for aggregations to have finer grained control of the CoreValuesSourceType for script values.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)
Should this builder serialize its targetValueType? Defaults to false.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
valueType()
Gets theValueType
for the value produced by this aggregationAB
valueType(ValueType valueType)
Sets theValueType
for the value produced by this aggregationMethods 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, 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, ValuesSourceType valuesSourceType, ValueType targetValueType) -
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<VS,AB> clone, AggregatorFactories.Builder factoriesBuilder, java.util.Map<java.lang.String,java.lang.Object> metaData) -
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType, ValueType targetValueType) throws java.io.IOExceptionRead an aggregation from a stream that has a sensible default for TargetValueType. This should be used by most subclasses. Subclasses needing to maintain backward compatibility to a version that did not serialize TargetValueType should use this constructor, providing the old, constant value for TargetValueType and overrideserializeTargetValueType(Version)
to return true only for versions that support the serialization.- Throws:
java.io.IOException
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType) throws java.io.IOExceptionRead an aggregation from a stream that serializes its targetValueType. This should only be used by subclasses that overrideserializeTargetValueType(Version)
to return true.- Throws:
java.io.IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteTo
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
- Throws:
java.io.IOException
-
innerWriteTo
Write subclass's state to the stream.- Throws:
java.io.IOException
-
serializeTargetValueType
Should this builder serialize its targetValueType? Defaults to false. All subclasses that override this to true should use the three argument read constructor rather than the four argument version.- 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. -
valueType
Sets theValueType
for the value produced by this aggregation -
valueType
Gets theValueType
for the value produced by this aggregation -
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<VS> doBuild(QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws java.io.IOException- Specified by:
doBuild
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
- Throws:
java.io.IOException
-
resolveScriptAny
Provide a hook for aggregations to have finer grained control of the CoreValuesSourceType for script values. This will only be called if the user did not supply a type hint for the script. The script object is provided for reference.- Parameters:
script
- - The user supplied script- Returns:
- The CoreValuesSourceType we expect this script to yield.
-
defaultValueType
Provide a hook for aggregations to have finer grained control of the ValueType for script values. This will only be called if the user did not supply a type hint for the script. The script object is provided for reference- Parameters:
script
- - the user supplied script- Returns:
- The ValueType we expect this script to yield
-
resolveConfig
-
innerBuild
protected abstract ValuesSourceAggregatorFactory<VS> innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<VS> config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws java.io.IOException- Throws:
java.io.IOException
-
internalXContent
public final XContentBuilder internalXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
internalXContent
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
- Throws:
java.io.IOException
-
doXContentBody
protected abstract XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
-