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
,Rewriteable<AggregationBuilder>
,BaseAggregationBuilder
,ToXContent
,ToXContentFragment
- Direct Known Subclasses:
AbstractRangeBuilder
,AutoDateHistogramAggregationBuilder
,DateHistogramAggregationBuilder
,DiversifiedAggregationBuilder
,GeoBoundsAggregationBuilder
,GeoDistanceAggregationBuilder
,GeoGridAggregationBuilder
,HistogramAggregationBuilder
,IpRangeAggregationBuilder
,MissingAggregationBuilder
,RareTermsAggregationBuilder
,SignificantTermsAggregationBuilder
,TermsAggregationBuilder
,ValuesSourceAggregationBuilder.LeafOnly
,VariableWidthHistogramAggregationBuilder
public abstract class ValuesSourceAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
extends AbstractAggregationBuilder<AB>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ValuesSourceAggregationBuilder.LeafOnly<VS extends ValuesSource,
AB extends ValuesSourceAggregationBuilder<AB>> static class
ValuesSourceAggregationBuilder.MetricsAggregationBuilder<VS extends ValuesSource,
AB extends ValuesSourceAggregationBuilder<AB>> static class
ValuesSourceAggregationBuilder.SingleMetricAggregationBuilder<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.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 inherited from class org.elasticsearch.search.aggregations.AbstractAggregationBuilder
metadata
Fields inherited from class org.elasticsearch.search.aggregations.AggregationBuilder
DEFAULT_PREALLOCATION, factoriesBuilder, name
Fields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDS
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
Read from a stream.protected
ValuesSourceAggregationBuilder
(ValuesSourceAggregationBuilder<AB> clone, AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metadata) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
declareFields
(AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>, T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware) static <T> void
declareFields
(AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>, T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware, boolean fieldRequired) protected abstract ValuesSourceType
Aggregations should use this method to define aValuesSourceType
of last resort.protected final ValuesSourceAggregatorFactory
doBuild
(AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) protected final void
doWriteTo
(StreamOutput out) protected abstract XContentBuilder
doXContentBody
(XContentBuilder builder, ToXContent.Params params) boolean
field()
Gets the field to use for this aggregation.Sets the field to use for this aggregation.format()
Gets the format to use for the output of the aggregation.Sets the format to use for the output of the aggregation.protected abstract ValuesSourceRegistry.RegistryKey<?>
int
hashCode()
protected abstract ValuesSourceAggregatorFactory
innerBuild
(AggregationContext context, ValuesSourceConfig config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) protected abstract void
innerWriteTo
(StreamOutput out) Write subclass's state to the stream.final XContentBuilder
internalXContent
(XContentBuilder builder, ToXContent.Params params) missing()
Gets the value to use when the aggregation finds a missing value in a documentSets the value to use when the aggregation finds a missing value in a documentprotected ValuesSourceConfig
resolveConfig
(AggregationContext context) Aggregations should override this if they need non-standard logic for resolving where to get values from.script()
Gets the script to use for this aggregation.Sets the script to use for this aggregation.protected boolean
serializeTargetValueType
(Version version) DO NOT OVERRIDE THIS!timeZone()
Gets the time zone to use for this aggregationSets the time zone to use for this aggregationuserValueTypeHint
(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, bytesToPreallocate, doRewrite, getName, getOutputFieldNames, getPipelineAggregations, getSubAggregations, isInSortOrderExecutionRequired, rewrite, shallowCopy, toString, validateSequentiallyOrdered, validateSequentiallyOrderedWithoutGaps
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.xcontent.ToXContentFragment
isFragment
-
Field Details
-
config
-
-
Constructor Details
-
ValuesSourceAggregationBuilder
-
ValuesSourceAggregationBuilder
protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<AB> clone, AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metadata) -
ValuesSourceAggregationBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
declareFields
public static <T> void declareFields(AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>, T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware) -
declareFields
public static <T> void declareFields(AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>, T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware, boolean fieldRequired) -
doWriteTo
- Specified by:
doWriteTo
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
- Throws:
IOException
-
innerWriteTo
Write subclass's state to the stream.- Throws:
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
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
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
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
Gets the time zone to use for this aggregation -
doBuild
protected final ValuesSourceAggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException - Specified by:
doBuild
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
- Throws:
IOException
-
getRegistryKey
-
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
Aggregations should override this if they need non-standard logic for resolving where to get values from. For example, join aggregations (like Parent and Child) ask the user to specify one side of the join and then look up the other field to read values from.The default implementation just uses the field and/or script the user provided.
- Returns:
- A
ValuesSourceConfig
configured based on the parsed field and/or script.
-
innerBuild
protected abstract ValuesSourceAggregatorFactory innerBuild(AggregationContext context, ValuesSourceConfig config, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException - Throws:
IOException
-
internalXContent
public final XContentBuilder internalXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
internalXContent
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
- Throws:
IOException
-
doXContentBody
protected abstract XContentBuilder doXContentBody(XContentBuilder builder, ToXContent.Params params) throws IOException - Throws:
IOException
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
-
equals
- Overrides:
equals
in classAbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
-