Package org.opensearch.search.aggregations.support
This package holds shared code for the aggregations framework, especially around dealing with values.
Key Classes
ValuesSource
and its subclasses
These are thin wrappers which provide a unified interface to different ways of getting input data (e.g. DocValues from Lucene, or script
output). A class hierarchy defines the type of values returned by the source. The top level sub-classes define type-specific behavior,
such as ValuesSource.Numeric.isFloatingPoint()
. Second level subclasses are
then specialized based on where they read values from, e.g. script or field cases. There are also adapter classes like
org.opensearch.search.aggregations.bucket.geogrid.CellIdSource which do run-time conversion from one type to another, often
dependent on a user specified parameter (precision in that case).
ValuesSourceRegistry
ValuesSourceRegistry stores the mappings for what types are supported by what aggregations. It is configured at startup, when
SearchModule
is configuring aggregations. It shouldn't be necessary to access the registry in most
cases, but you can get a read copy from QueryShardContext.getValuesSourceRegistry()
if necessary.
ValuesSourceType
ValuesSourceTypes are the quantum of support in the aggregations framework, and provide a common language between fields and
aggregations. Fields which support aggregation set a ValuesSourceType on their IndexFieldData
implementations, and aggregations register what types they support via one of the
ValuesSourceRegistry.Builder.register(org.opensearch.search.aggregations.support.ValuesSourceRegistry.RegistryKey<T>, org.opensearch.search.aggregations.support.ValuesSourceType, T, boolean)
methods. The VaulesSourceType itself holds
information on how to with values of that type, including methods for creating
ValuesSource
instances and DocValueFormat
instances.
ValuesSourceConfig
There are two things going on in ValuesSourceConfig. First, there is a collection of static factory methods to build valid configs for
different situations. ValuesSourceAggregationBuilder.resolveConfig(org.opensearch.index.query.QueryShardContext)
has a good
default for what to call here and generally aggregations shouldn't need to deviate from that.
Once properly constructed, the ValuesSourceConfig provides access to the ValuesSource instance, as well as related information like the formatter. Aggregations are free to use this information as needed, such as Max and Min which inspect the field context to see if they can apply an optimization.
Classes we are trying to phase out
ValueType
This class is primarily used for parsing user type hints, and is deprecated for new use. Work is ongoing to remove it from existing code.
-
ClassDescriptionData describing an aggProvides a set of static helpers to determine if a particular type of InternalAggregation "has a value" or not.A path that can be used to sort/order buckets (in some multi-bucket aggregations, e.g.Element in an agg pathService to track telemetry about aggregationsBuilder for the Agg usage service to track telemetryA configuration that tells aggregation how to retrieve data from index in order to run a specific aggregation.BaseMultiValuesSourceFieldConfig.Builder<C extends BaseMultiValuesSourceFieldConfig,
B extends BaseMultiValuesSourceFieldConfig.Builder<C, B>> Base builder for the multi values source field configurationCoreValuesSourceType
holds theValuesSourceType
implementations for the core aggregations package.Used by all field data based aggregators.Utility class that allows to return views ofValuesSource
s that replace the missing value with a configured value.A configuration that used by multi_terms aggregations.Builder for the multi terms values source configurationParser supplier functionMultiValuesSource<VS extends ValuesSource>Class to encapsulate a set of ValuesSource objects labeled by field nameNumeric formatSimilar toValuesSourceAggregationBuilder
, except it references multiple ValuesSources (e.g.Base leaf only classBase class for MultiValuesSource aggregator factoriesBase field configuration class for multi valuesBuilder for the field configHelper class to parse multi values sourcesBase class for a ValuesSource; the primitive data for an aggBytes typeField data without ordinalsValuesSource
implementation for stand alone scripts returning a Bytes valueProvides ordinals for bytesField data for the bytes values sourceValuesSource
subclass for Bytes fields with a Value Script appliedGeo point values sourceField data for geo point values sourceThe primitive data type for doing an aggregation on the GeoShapeField data for geo shape values sourceNumeric values source typeField data for numericsValuesSource
implementation for stand alone scripts returning a Numeric valueValuesSource
subclass for Numeric fields with a Value Script appliedRange typeValuesSourceAggregationBuilder<AB extends ValuesSourceAggregationBuilder<AB>>Base class for all values source agg buildersValuesSourceAggregationBuilder.LeafOnly<VS extends ValuesSource,AB extends ValuesSourceAggregationBuilder<AB>> Base leaf onlyBase class for all values source agg factoriesA configuration that tells aggregations how to retrieve data from the index in order to run a specific aggregation.ValuesSourceRegistry
holds the mapping fromValuesSourceType
s to functions for building aggregation components.Builder for the values source registryThe registry key for the values source registry key=======ValuesSourceType
represents a collection of fields that share a common set of operations, for example all numeric fields.Enum to signal what kind of value type is used in the aggregator