Class ValuesSourceAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>

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, Rewriteable<AggregationBuilder>, BaseAggregationBuilder
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>
  • Field Details

  • Constructor Details

    • ValuesSourceAggregationBuilder

      protected ValuesSourceAggregationBuilder( name)
    • ValuesSourceAggregationBuilder

      protected ValuesSourceAggregationBuilder(ValuesSourceAggregationBuilder<AB> clone, AggregatorFactories.Builder factoriesBuilder, <,​> metadata)
    • ValuesSourceAggregationBuilder

      protected ValuesSourceAggregationBuilder(StreamInput in) throws
      Read from a stream.
      Throws:
  • Method Details

    • declareFields

      public static <T> void declareFields(org.elasticsearch.common.xcontent.AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>,​T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware)
    • declareFields

      public static <T> void declareFields(org.elasticsearch.common.xcontent.AbstractObjectParser<? extends ValuesSourceAggregationBuilder<?>,​T> objectParser, boolean scriptable, boolean formattable, boolean timezoneAware, boolean fieldRequired)
    • doWriteTo

      protected final void doWriteTo(StreamOutput out) throws
      Specified by:
      doWriteTo in class AbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
      Throws:
    • innerWriteTo

      protected abstract void innerWriteTo(StreamOutput out) throws
      Write subclass's state to the stream.
      Throws:
    • serializeTargetValueType

      protected boolean serializeTargetValueType(Version version)
      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

      public  field)
      Sets the field to use for this aggregation.
    • field

      public  field()
      Gets the field to use for this aggregation.
    • script

      public AB script(Script script)
      Sets the script to use for this aggregation.
    • script

      public Script script()
      Gets the script to use for this aggregation.
    • userValueTypeHint

      public AB userValueTypeHint(ValueType valueType)
      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 parsed ValueType based on the string the user specified
      Returns:
      - The modified builder instance, for chaining.
    • userValueTypeHint

      public ValueType userValueTypeHint()
    • format

      public  format)
      Sets the format to use for the output of the aggregation.
    • format

      public  format()
      Gets the format to use for the output of the aggregation.
    • missing

      public  missing)
      Sets the value to use when the aggregation finds a missing value in a document
    • missing

      public  missing()
      Gets the value to use when the aggregation finds a missing value in a document
    • timeZone

      public  timeZone)
      Sets the time zone to use for this aggregation
    • timeZone

      public  timeZone()
      Gets the time zone to use for this aggregation
    • doBuild

      protected final ValuesSourceAggregatorFactory doBuild(AggregationContext context, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws
      Specified by:
      doBuild in class AbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
      Throws:
    • getRegistryKey

      protected abstract ValuesSourceRegistry.RegistryKey<?> getRegistryKey()
    • defaultValueSourceType

      protected abstract ValuesSourceType defaultValueSourceType()
      Aggregations should use this method to define a ValuesSourceType 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

      protected ValuesSourceConfig resolveConfig(AggregationContext context)
      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
      Throws:
    • internalXContent

      public final org.elasticsearch.common.xcontent.XContentBuilder internalXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      internalXContent in class AbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
      Throws:
    • doXContentBody

      protected abstract org.elasticsearch.common.xcontent.XContentBuilder doXContentBody(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Throws:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>
    • equals

      public boolean equals( obj)
      Overrides:
      equals in class AbstractAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>