Interface ValuesSourceType

All Known Implementing Classes:
CoreValuesSourceType

public interface ValuesSourceType
ValuesSourceType wraps the creation of specific per-source instances each ValuesSource needs to provide. Every top-level subclass of ValuesSource should have a corresponding implementation of this interface. In general, new data types seeking aggregation support should create a top level ValuesSource, then implement this to return wrappers for the specific sources of values.
  • Method Details

    • getEmpty

      ValuesSource getEmpty()
      Called when an aggregation is operating over a known empty set (usually because the field isn't specified), this method allows for returning a no-op implementation. All ValuesSources should implement this method.
      Returns:
      - Empty specialization of the base ValuesSource
    • getScript

      ValuesSource getScript​(AggregationScript.LeafFactory script, ValueType scriptValueType)
      Returns the type-specific sub class for a script data source. ValuesSources that do not support scripts should throw AggregationExecutionException. Note that this method is called when a script is operating without an underlying field. Scripts operating over fields are handled by the script argument to getField below.
      Parameters:
      script - - The script being wrapped
      scriptValueType - - The expected output type of the script
      Returns:
      - Script specialization of the base ValuesSource
    • getField

      ValuesSource getField​(FieldContext fieldContext, AggregationScript.LeafFactory script)
      Return a ValuesSource wrapping a field for the given type. All ValuesSources must implement this method.
      Parameters:
      fieldContext - - The field being wrapped
      script - - Optional script that might be applied over the field
      Returns:
      - Field specialization of the base ValuesSource
    • replaceMissing

      ValuesSource replaceMissing​(ValuesSource valuesSource, java.lang.Object rawMissing, DocValueFormat docValueFormat, java.util.function.LongSupplier now)
      Apply the given missing value to an already-constructed ValuesSource. Types which do not support missing values should throw AggregationExecutionException
      Parameters:
      valuesSource - - The original ValuesSource
      rawMissing - - The missing value we got from the parser, typically a string or number
      docValueFormat - - The format to use for further parsing the user supplied value, e.g. a date format
      now - - Used in conjunction with the formatter, should return the current time in milliseconds
      Returns:
      - Wrapper over the provided ValuesSource to apply the given missing value