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 Summary
Modifier and Type Method Description 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.ValuesSource
getField(FieldContext fieldContext, AggregationScript.LeafFactory script)
Return aValuesSource
wrapping a field for the given type.ValuesSource
getScript(AggregationScript.LeafFactory script, ValueType scriptValueType)
Returns the type-specific sub class for a script data source.ValuesSource
replaceMissing(ValuesSource valuesSource, java.lang.Object rawMissing, DocValueFormat docValueFormat, java.util.function.LongSupplier now)
Apply the given missing value to an already-constructedValuesSource
.
-
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. AllValuesSource
s should implement this method.- Returns:
- - Empty specialization of the base
ValuesSource
-
getScript
Returns the type-specific sub class for a script data source.ValuesSource
s that do not support scripts should throwAggregationExecutionException
. 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 wrappedscriptValueType
- - The expected output type of the script- Returns:
- - Script specialization of the base
ValuesSource
-
getField
Return aValuesSource
wrapping a field for the given type. AllValuesSource
s must implement this method.- Parameters:
fieldContext
- - The field being wrappedscript
- - 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-constructedValuesSource
. Types which do not support missing values should throwAggregationExecutionException
- Parameters:
valuesSource
- - The originalValuesSource
rawMissing
- - The missing value we got from the parser, typically a string or numberdocValueFormat
- - The format to use for further parsing the user supplied value, e.g. a date formatnow
- - 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
-