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 classValuesSourceAggregationBuilder.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
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedValuesSourceAggregationBuilder(String name, ValuesSourceType valuesSourceType, ValueType targetValueType)protectedValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType)Read an aggregation from a stream that serializes its targetValueType.protectedValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType, ValueType targetValueType)Read an aggregation from a stream that has a sensible default for TargetValueType.protectedValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<VS,AB> clone, AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metaData)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ValueTypedefaultValueType(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 voiddoWriteTo(StreamOutput out)protected abstract XContentBuilderdoXContentBody(XContentBuilder builder, ToXContent.Params params)booleanequals(Object obj)Stringfield()Gets the field to use for this aggregation.ABfield(String field)Sets the field to use for this aggregation.Stringformat()Gets the format to use for the output of the aggregation.ABformat(String format)Sets the format to use for the output of the aggregation.inthashCode()protected abstract ValuesSourceAggregatorFactory<VS>innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<VS> config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder)protected abstract voidinnerWriteTo(StreamOutput out)Write subclass's state to the stream.XContentBuilderinternalXContent(XContentBuilder builder, ToXContent.Params params)Objectmissing()Gets the value to use when the aggregation finds a missing value in a documentABmissing(Object missing)Sets the value to use when the aggregation finds a missing value in a documentprotected ValuesSourceConfig<VS>resolveConfig(QueryShardContext queryShardContext)protected ValuesSourceTyperesolveScriptAny(Script script)Provide a hook for aggregations to have finer grained control of the ValuesSourceType for script values.Scriptscript()Gets the script to use for this aggregation.ABscript(Script script)Sets the script to use for this aggregation.protected booleanserializeTargetValueType(Version version)Should this builder serialize its targetValueType? Defaults to false.ZoneIdtimeZone()Gets the time zone to use for this aggregationABtimeZone(ZoneId timeZone)Sets the time zone to use for this aggregationValueTypevalueType()Gets theValueTypefor the value produced by this aggregationABvalueType(ValueType valueType)Sets theValueTypefor the value produced by this aggregation-
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, 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
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
config
protected ValuesSourceConfig<VS extends ValuesSource> config
-
-
Constructor Detail
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(String name, ValuesSourceType valuesSourceType, ValueType targetValueType)
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<VS,AB> clone, AggregatorFactories.Builder factoriesBuilder, Map<String,Object> metaData)
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType, ValueType targetValueType) throws IOException
Read 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:
IOException
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(StreamInput in, ValuesSourceType valuesSourceType) throws IOException
Read an aggregation from a stream that serializes its targetValueType. This should only be used by subclasses that overrideserializeTargetValueType(Version)to return true.- Throws:
IOException
-
-
Method Detail
-
doWriteTo
protected final void doWriteTo(StreamOutput out) throws IOException
- Specified by:
doWriteToin classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>- Throws:
IOException
-
innerWriteTo
protected abstract void innerWriteTo(StreamOutput out) throws IOException
Write subclass's state to the stream.- Throws:
IOException
-
serializeTargetValueType
protected boolean serializeTargetValueType(Version version)
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
public String field()
Gets the field to use for this aggregation.
-
script
public Script script()
Gets the script to use for this aggregation.
-
valueType
public AB valueType(ValueType valueType)
Sets theValueTypefor the value produced by this aggregation
-
valueType
public ValueType valueType()
Gets theValueTypefor the value produced by this aggregation
-
format
public String format()
Gets the format to use for the output of the aggregation.
-
missing
public AB missing(Object missing)
Sets the value to use when the aggregation finds a missing value in a document
-
missing
public Object missing()
Gets the value to use when the aggregation finds a missing value in a document
-
timeZone
public 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 IOException
- Specified by:
doBuildin classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>- Throws:
IOException
-
resolveScriptAny
protected ValuesSourceType resolveScriptAny(Script script)
Provide a hook for aggregations to have finer grained control of the ValuesSourceType 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 ValuesSourceType we expect this script to yield.
-
defaultValueType
protected ValueType defaultValueType(Script script)
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
protected ValuesSourceConfig<VS> resolveConfig(QueryShardContext queryShardContext)
-
innerBuild
protected abstract ValuesSourceAggregatorFactory<VS> innerBuild(QueryShardContext queryShardContext, ValuesSourceConfig<VS> config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException
- Throws:
IOException
-
internalXContent
public final XContentBuilder internalXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
- Specified by:
internalXContentin classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>- Throws:
IOException
-
doXContentBody
protected abstract XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws IOException
- Throws:
IOException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<VS,AB>>
-
-