diff --git a/docs/changelog/140478.yaml b/docs/changelog/140478.yaml new file mode 100644 index 0000000000000..8e9f77e377336 --- /dev/null +++ b/docs/changelog/140478.yaml @@ -0,0 +1,5 @@ +pr: 140478 +summary: T digest field type docs +area: Mapping +type: enhancement +issues: [] diff --git a/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md b/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md new file mode 100644 index 0000000000000..48a9250463207 --- /dev/null +++ b/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md @@ -0,0 +1,199 @@ +--- +applies_to: + stack: preview 9.3 + serverless: preview +navigation_title: "Exponential histogram" +--- + +# Exponential histogram field type [exponential-histogram] + +A field to store pre-aggregated numerical data using an exponential histogram, compatible with the OpenTelemetry data model. This field captures a distribution of values with fixed, exponentially spaced bucket boundaries controlled by a `scale` parameter, and a special zero bucket for values close to zero. + +An exponential histogram field has the following structure: + +```text +{ + "scale": , + "sum": , + "min": , + "max": , + "zero": { + "threshold": , + "count": + }, + "positive": { + "indices": [...], + "counts": [...] + }, + "negative": { + "indices": [...], + "counts": [...] + } +} +``` + +The `scale` controls the bucket density and precision. Larger scales produce finer buckets. Must be in the range `[-11, 38]`. + +Exponential histograms can represent both positive and negative values, which are split into separate bucket ranges. +Each bucket range is an object with two parallel arrays: +- `indices`: array of the bucket indices defining the bucket boundaries. Each value must be in the range `[-((2^62) - 1), (2^62) - 1]`. +- `counts`: array of counts for the corresponding buckets. Must have the same length as `indices`, each value must be `>= 0`. + +If either `positive` or `negative` is omitted, it is treated as an empty set of buckets. + +See the ["Bucket boundaries and scale"](#exponential-histogram-buckets) section below for how bucket indices map to value ranges. +The indices should be provided in sorted order. Unsorted indices are supported, but will incur a performance penalty during indexing. + +In order to represent zero values or values close to zero, there is a special `zero` bucket, which consists of: + - `threshold`: that defines the upper bound considered "zero". Must be non-negative. Defaults to `0.0`. + - `count`: number of values in the zero bucket. Defaults to `0`. + +The `zero` object can be omitted, in that case `threshold` and `count` are set to their default values. + +Optionally, you can include precomputed summary statistics: + +- `sum`: The sum of all values in the histogram +- `min`: The minimum value in the histogram +- `max`: The maximum value in the histogram + +When `sum`, `min`, or `max` are omitted, Elasticsearch will estimate these values during indexing. +If the histogram is empty (no positive/negative buckets and zero count is `0`), then `sum` must be `0.0` or omitted, and `min` and `max` must be omitted or `null`. + +## Limitations + +- An `exponential_histogram` field is single-valued: one histogram per field per document. Nested arrays are not supported. +- `exponential_histogram` fields are not searchable and do not support sorting. + +## Use cases [exponential-histogram-use-cases] + +`exponential_histogram` fields are primarily intended for use with aggregations. To make them efficient for aggregations, the histogram is stored as compact [doc values](/reference/elasticsearch/mapping-reference/doc-values.md) and not indexed. + +Exponential histograms are supported in ES|QL; see the [ES|QL reference](/reference/query-languages/esql.md) for details. + +In Query DSL, because the data is not indexed, you can use `exponential_histogram` fields only with the following aggregations: + +- [sum](/reference/aggregations/search-aggregations-metrics-sum-aggregation.md) aggregation +- [avg](/reference/aggregations/search-aggregations-metrics-avg-aggregation.md) aggregation +- [value_count](/reference/aggregations/search-aggregations-metrics-valuecount-aggregation.md) aggregation +- [histogram](/reference/aggregations/search-aggregations-bucket-histogram-aggregation.md) aggregation + +## Synthetic `_source` [exponential-histogram-synthetic-source] + +`exponential_histogram` fields support [synthetic `_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md) in their default configuration. + +When `_source` is reconstructed, empty positive/negative bucket ranges and a zero bucket with `count: 0` and `threshold: 0` may be omitted in the serialized form. + +## Examples [exponential-histogram-ex] + +Create an index with an `exponential_histogram` field and a `keyword` field: + +```console +PUT my-index-000001 +{ + "mappings": { + "properties": { + "my_histo": { + "type": "exponential_histogram" + }, + "title": { "type": "keyword" } + } + } +} +``` + +Index a document with a full exponential histogram payload: + +```console +PUT my-index-000001/_doc/1 +{ + "title": "histo_1", + "my_histo": { + "scale": 12, + "sum": 1234.0, + "min": -123.456, + "max": 456.456, + "zero": { + "threshold": 0.001, + "count": 42 + }, + "positive": { + "indices": [-10, 25, 26], + "counts": [ 2, 3, 4] + }, + "negative": { + "indices": [-5, 0], + "counts": [10, 7] + } + } +} +``` + +Indexing an empty histogram is allowed. The `sum` must be `0.0` or omitted and `min` and `max` must be omitted: + +```console +PUT my-index-000001/_doc/2 +{ + "title": "empty", + "my_histo": { + "scale": 10, + "zero": { "threshold": 0.42 } + } +} +``` + +## Coercion from T-Digest [exponential-histogram-coercion] + +In order to facilitate a transition from the existing `histogram` field type, `exponential_histogram` fields support coercion from the `histogram` field type's `values`/`counts` format. +When `coerce` is enabled (default), Elasticsearch will interpret data provided as `values` and `counts` arrays as T-Digest and convert it to an exponential histogram during indexing. + +```console +PUT my-index-000002 +{ + "mappings": { + "properties": { + "my_histo": { + "type": "exponential_histogram" + } + } + } +} + +PUT my-index-000002/_doc/1 +{ + "my_histo": { + "values": [0.1, 0.2, 0.3, 0.4, 0.5], + "counts": [3, 7, 23, 12, 6] + } +} +``` + +To reject legacy input, disable coercion on the field mapping or at the index level. See [coerce](/reference/elasticsearch/mapping-reference/coerce.md). + +## Bucket boundaries and scale [exponential-histogram-buckets] + +Exponential histograms use exponentially growing bucket widths. All bucket boundaries are derived from a base and an integer bucket index: + +The base is defined via the `scale` as follows: + +:::{math} +\text{base} = 2^{2^{-\text{scale}}} +::: + +The positive bucket with the index `i` covers the interval + +:::{math} +(\text{base}^i,\; \text{base}^{i+1}] +::: + +The negative bucket with the index `i` covers the interval + +:::{math} +[-\text{base}^{i+1},\; -\text{base}^i) +::: + +Values with absolute value less than or equal to `zero.threshold` belong to the special zero bucket. + +Changing the scale adjusts bucket widths: + +- Increasing the scale by 1 splits each bucket into two adjacent buckets. +- Decreasing the scale by 1 merges each pair of adjacent buckets into a single bucket without introducing additional error due to, e.g., rounding or interpolation. diff --git a/docs/reference/elasticsearch/mapping-reference/field-data-types.md b/docs/reference/elasticsearch/mapping-reference/field-data-types.md index 8189e809af4a1..a27c33e62adc7 100644 --- a/docs/reference/elasticsearch/mapping-reference/field-data-types.md +++ b/docs/reference/elasticsearch/mapping-reference/field-data-types.md @@ -77,6 +77,9 @@ Dates [`histogram`](/reference/elasticsearch/mapping-reference/histogram.md) : Pre-aggregated numerical values in the form of a histogram. +[`tdigest`](/reference/elasticsearch/mapping-reference/t-digest.md) {applies_to}`stack: preview 9.3+` {applies_to}`serverless: preview` +: Pre-aggregated numerical values in the form of a T-Digest. + ### Text search types [text-search-types] diff --git a/docs/reference/elasticsearch/mapping-reference/t-digest.md b/docs/reference/elasticsearch/mapping-reference/t-digest.md new file mode 100644 index 0000000000000..410c495f981f1 --- /dev/null +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -0,0 +1,123 @@ +--- +applies_to: + stack: preview 9.3 + serverless: preview +navigation_title: "T-digest" +--- + +# T-digest field type [tdigest] + +A field to store pre-aggregated numerical data constructed using the [T-Digest](/reference/aggregations/search-aggregations-metrics-percentile-aggregation.md) algorithm. + +## Structure of a `tdigest` field + +A `tdigest` field requires two arrays: + +* A `centroids` array of + [`double`](/reference/elasticsearch/mapping-reference/number.md), containing + the computed centroids. These must be provided in ascending order. +* A `counts` array of + [`long`](/reference/elasticsearch/mapping-reference/number.md), containing the + computed counts for each of the centroids. This must be the same length as + the `centroids` array + +The field also accepts three optional summary fields: + +* `sum`, a [`double`](/reference/elasticsearch/mapping-reference/number.md), + representing the sum of the values being summarized by the t-digest +* `min`, a [`double`](/reference/elasticsearch/mapping-reference/number.md), + representing the minimum of the values being summarized by the t-digest +* `max`, a [`double`](/reference/elasticsearch/mapping-reference/number.md), + representing the maximum of the values being summarized by the t-digest + +Specifying the summary values enables them to be calculated with +higher accuracy from the raw data. If not specified, Elasticsearch +computes them based on the given `centroids` and `counts`, with some loss of +accuracy. + +## Limitations + +* A `tdigest` field can only store a single sketch per document. Multi-values or nested arrays are not supported. +* `tdigest` fields do not support sorting and are not searchable. + + +## Configuring T-Digest Fields + +T-Digest fields accept two field-specific configuration parameters: + +* `compression`, a + [`double`](/reference/elasticsearch/mapping-reference/number.md) between `0` and + `10000` (excluding `0`), which corresponds to the parameter of the same name in + the [T-Digest](/reference/aggregations/search-aggregations-metrics-percentile-aggregation.md) algorithm. + In general, the higher this number, the more space on disk the field will use + but the more accurate the sketch approximations will be. Default is `100` +* `digest_type`, which selects the merge strategy to use with the sketch. Valid + values are `default` and `high_accuracy`. The default is `default`. The + `default` is optimized for storage and performance, while still producing a + good approximation. The `high_accuracy` variant uses more memory, disk, and + CPU for a better approximation. + +## Use cases [tdigest-use-cases] + +`tdigest` fields are primarily intended for use with aggregations. To make them +efficient for aggregations, the data are stored as compact [doc +values](/reference/elasticsearch/mapping-reference/doc-values.md) and not +indexed. + +`tdigest` fields are supported in the following [ES|QL](/reference/query-languages/esql.md) aggregation functions: + +* [Avg](/reference/query-languages/esql/functions-operators/aggregation-functions.md#esql-avg) +* [Max](/reference/query-languages/esql/functions-operators/aggregation-functions.md#esql-max) + and + [Min](/reference/query-languages/esql/functions-operators/aggregation-functions.md#esql-min) +* [Percentile](/reference/query-languages/esql/functions-operators/aggregation-functions.md#esql-percentile) +* [Present](/reference/query-languages/esql/functions-operators/aggregation-functions.md#esql-present) and + [Absent](/reference/query-languages/esql/functions-operators/aggregation-functions.md#esql-absent) + + +## Synthetic `_source` [tdigest-synthetic-source] + +`tdigest` fields support [synthetic `_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source) in their default configuration. + +::::{note} +To save space, zero-count buckets are not stored in `tdigest` doc values. If you index a `tdigest` field with zero-count buckets and synthetic `_source` is enabled, those buckets won't appear when you retrieve the field. +:::: + +## Examples + +### Create an index with a `tdigest` field + +```console +PUT my-index-000001 +{ + "mappings": { + "properties": { + "latency": { + "type": "tdigest" + } + } + } +} +``` + +### Index a simple document + +```console +PUT my-index-000001/_doc/1 +{ + "latency": { + "centroids": [0.1, 0.2, 0.3, 0.4, 0.5], + "counts": [3, 7, 23, 12, 6] + } +} +``` + +### Query via ES|QL + +```console +POST /_query?format=txt +{ + "query": "FROM test | STATS Percentile(99, latency)" +} + + diff --git a/docs/reference/elasticsearch/toc.yml b/docs/reference/elasticsearch/toc.yml index 9b08a432b9c0a..5fae1f0831985 100644 --- a/docs/reference/elasticsearch/toc.yml +++ b/docs/reference/elasticsearch/toc.yml @@ -158,6 +158,8 @@ toc: - file: mapping-reference/geo-point.md - file: mapping-reference/geo-shape.md - file: mapping-reference/histogram.md + - file: mapping-reference/exponential-histogram.md + - file: mapping-reference/t-digest.md - file: mapping-reference/ip.md - file: mapping-reference/parent-join.md - file: mapping-reference/keyword.md diff --git a/docs/reference/query-languages/esql/limitations.md b/docs/reference/query-languages/esql/limitations.md index 3edb8a74d8618..bdb07de5aa2bd 100644 --- a/docs/reference/query-languages/esql/limitations.md +++ b/docs/reference/query-languages/esql/limitations.md @@ -32,7 +32,7 @@ By default, an {{esql}} query returns up to 1,000 rows. You can increase the num * You can use `to_datetime` to cast to millisecond dates to use unsupported functions * `double` (`float`, `half_float`, `scaled_float` are represented as `double`) -* `dense_vector` {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` +* `dense_vector` {applies_to}`stack: preview 9.2+` {applies_to}`serverless: preview` * `ip` * `keyword` [family](/reference/elasticsearch/mapping-reference/keyword.md) including `keyword`, `constant_keyword`, and `wildcard` * `int` (`short` and `byte` are represented as `int`) @@ -47,28 +47,24 @@ By default, an {{esql}} query returns up to 1,000 rows. You can increase the num * `geo_shape` * `point` * `shape` -* TSDB metrics {applies_to}`stack: preview 9.2` {applies_to}`serverless: preview` +* TSDB metrics {applies_to}`stack: preview 9.2+` {applies_to}`serverless: preview` * `counter` * `gauge` * `aggregate_metric_double` + * `exponential_histogram` {applies_to}`stack: preview 9.3+` {applies_to}`serverless: preview` + * `tdigest` {applies_to}`stack: preview 9.3+` {applies_to}`serverless: preview` ### Unsupported types [_unsupported_types] -{{esql}} does not yet support the following field types: +{{esql}} does not support certain field types. If the limitation only applies to specific product versions, it is indicated in the following list: -::::{tab-set} -:::{tab-item} 9.0-9.1 -* `dense_vector` -* TSDB metrics +* {applies_to}`stack: ga 9.0-9.1` `dense_vector` +* {applies_to}`stack: ga 9.0-9.1` TSDB metrics * `counter` * `gauge` * `aggregate_metric_double` -::: -:::{tab-item} 9.2+ -This limitation no longer exists and TSDB metrics and `dense_vector` are now supported (preview). -::: -:::: + * Date/time * `date_range` @@ -177,58 +173,13 @@ FROM books | WHERE MATCH(author, "Faulkner") ``` -Note that, because of [the way {{esql}} treats `text` values](#esql-limitations-text-fields), -any queries on `text` fields that do not explicitly use the full-text functions, +Note that any queries on `text` fields that do not explicitly use the full-text functions, [`MATCH`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match), [`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-qstr) or [`KQL`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-kql), will behave as if the fields are actually `keyword` fields: they are case-sensitive and need to match the full string. -## `text` fields behave like `keyword` fields [esql-limitations-text-fields] - -While {{esql}} supports [`text`](/reference/elasticsearch/mapping-reference/text.md) fields, {{esql}} does not treat these fields like the Search API does. {{esql}} queries do not query or aggregate the [analyzed string](docs-content://manage-data/data-store/text-analysis.md). Instead, an {{esql}} query will try to get a `text` field’s subfield of the [keyword family type](/reference/elasticsearch/mapping-reference/keyword.md) and query/aggregate that. If it’s not possible to retrieve a `keyword` subfield, {{esql}} will get the string from a document’s `_source`. If the `_source` cannot be retrieved, for example when using synthetic source, `null` is returned. - -Once a `text` field is retrieved, if the query touches it in any way, for example passing it into a function, the type will be converted to `keyword`. In fact, functions that operate on both `text` and `keyword` fields will perform as if the `text` field was a `keyword` field all along. - -For example, the following query will return a column `greatest` of type `keyword` no matter whether any or all of `field1`, `field2`, and `field3` are of type `text`: - -```esql -| FROM index -| EVAL greatest = GREATEST(field1, field2, field3) -``` - -Note that {{esql}}'s retrieval of `keyword` subfields may have unexpected consequences. -Other than when explicitly using the full-text functions, -[`MATCH`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-match) and -[`QSTR`](/reference/query-languages/esql/functions-operators/search-functions.md#esql-qstr), -any {{esql}} query on a `text` field is case-sensitive. - -For example, after indexing a field of type `text` with the value `Elasticsearch query language`, the following `WHERE` clause does not match because the `LIKE` operator is case-sensitive: - -```esql -| WHERE field LIKE "elasticsearch query language" -``` - -The following `WHERE` clause does not match either, because the `LIKE` operator tries to match the whole string: - -```esql -| WHERE field LIKE "Elasticsearch" -``` - -As a workaround, use wildcards and regular expressions. For example: - -```esql -| WHERE field RLIKE "[Ee]lasticsearch.*" -``` - -Furthermore, a subfield may have been mapped with a [normalizer](/reference/elasticsearch/mapping-reference/normalizer.md), which can transform the original string. Or it may have been mapped with [`ignore_above`](/reference/elasticsearch/mapping-reference/ignore-above.md), which can truncate the string. None of these mapping operations are applied to an {{esql}} query, which may lead to false positives or negatives. - -To avoid these issues, a best practice is to be explicit about the field that you query, -and query `keyword` sub-fields instead of `text` fields. -Or consider using one of the [full-text search](/reference/query-languages/esql/functions-operators/search-functions.md) functions. - - ## Using {{esql}} to query multiple indices [esql-multi-index-limitations] As discussed in more detail in [Using {{esql}} to query multiple indices](/reference/query-languages/esql/esql-multi-index.md), {{esql}} can execute a single query across multiple indices, data streams, or aliases. However, there are some limitations to be aware of: @@ -238,12 +189,12 @@ As discussed in more detail in [Using {{esql}} to query multiple indices](/refer ## Time series data streams [esql-tsdb] -::::{tab-set} -:::{tab-item} 9.0-9.1 -{{esql}} does not support querying time series data streams (TSDS). +::::{applies-switch} +:::{applies-item} stack: preview 9.2+ +Time series data streams (TSDS) are supported in technical preview. ::: -:::{tab-item} 9.2+ -This limitation no longer exists and time series data streams (TSDS) are now supported (preview). +:::{applies-item} stack: ga 9.0-9.1 +{{esql}} does not support querying time series data streams (TSDS). ::: :::: @@ -310,16 +261,12 @@ Also, [`INLINE STATS`](/reference/query-languages/esql/commands/inlinestats-by.m ## Kibana limitations [esql-limitations-kibana] -* The user interface to filter data is not enabled when Discover is in {{esql}} mode. To filter data, write a query that uses the [`WHERE`](/reference/query-languages/esql/commands/where.md) command instead. +* The filter bar interface is not enabled when Discover is in {{esql}} mode. To filter data, use [variable controls](docs-content://explore-analyze/discover/try-esql.md#add-variable-control), filter buttons within the table and field list, or write a query that uses the [`WHERE`](/reference/query-languages/esql/commands/where.md) command instead. * Discover shows no more than 10,000 rows. This limit only applies to the number of rows that are retrieved by the query and displayed in Discover. Queries and aggregations run on the full data set. * Discover shows no more than 50 columns. If a query returns more than 50 columns, Discover only shows the first 50. * CSV export from Discover shows no more than 10,000 rows. This limit only applies to the number of rows that are retrieved by the query and displayed in Discover. Queries and aggregations run on the full data set. * Querying many indices at once without any filters can cause an error in kibana which looks like `[esql] > Unexpected error from Elasticsearch: The content length (536885793) is bigger than the maximum allowed string (536870888)`. The response from {{esql}} is too long. Use [`DROP`](/reference/query-languages/esql/commands/drop.md) or [`KEEP`](/reference/query-languages/esql/commands/keep.md) to limit the number of fields returned. -## Cross-cluster search limitations [esql-ccs-limitations] - -{{esql}} does not support [Cross-Cluster Search (CCS)](docs-content://explore-analyze/cross-cluster-search.md) on [`semantic_text` fields](/reference/elasticsearch/mapping-reference/semantic-text.md). - ## Known issues [esql-known-issues] Refer to [Known issues](/release-notes/known-issues.md) for a list of known issues for {{esql}}. diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapper.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapper.java index 039b22f9a95c6..c57c4e1bddc79 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapper.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapper.java @@ -51,7 +51,7 @@ import org.elasticsearch.script.field.DocValuesScriptFieldFactory; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; -import org.elasticsearch.search.aggregations.metrics.TDigestState; +import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; import org.elasticsearch.search.sort.BucketedSort; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.tdigest.parsing.TDigestParser; @@ -89,7 +89,7 @@ public static class Builder extends FieldMapper.Builder { private final Parameter> meta = Parameter.metaParam(); private final Parameter> ignoreMalformed; - private final Parameter digestType; + private final Parameter digestType; private final Parameter compression; public Builder(String name, boolean ignoreMalformedByDefault) { @@ -104,8 +104,8 @@ public Builder(String name, boolean ignoreMalformedByDefault) { "digest_type", false, m -> toType(m).digestType, - TDigestState.Type.HYBRID, - TDigestState.Type.class + TDigestExecutionHint.DEFAULT, + TDigestExecutionHint.class ); this.compression = new Parameter<>( "compression", @@ -147,7 +147,7 @@ public TDigestFieldMapper build(MapperBuilderContext context) { private final Explicit ignoreMalformed; private final boolean ignoreMalformedByDefault; - private final TDigestState.Type digestType; + private final TDigestExecutionHint digestType; private final double compression; public TDigestFieldMapper(String simpleName, MappedFieldType mappedFieldType, BuilderParams builderParams, Builder builder) { @@ -163,7 +163,7 @@ public boolean ignoreMalformed() { return ignoreMalformed.value(); } - public TDigestState.Type digestType() { + public TDigestExecutionHint digestType() { return digestType; } diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java index f0b7615f5141e..19039162f0587 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java @@ -14,7 +14,7 @@ import org.elasticsearch.datageneration.datasource.DataSourceResponse; import org.elasticsearch.index.mapper.BlockLoaderTestCase; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.search.aggregations.metrics.TDigestState; +import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.analytics.AnalyticsPlugin; @@ -55,7 +55,7 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques if (ESTestCase.randomBoolean()) { map.put("ignore_malformed", ESTestCase.randomBoolean()); map.put("compression", randomDoubleBetween(1.0, 1000.0, true)); - map.put("digest_type", randomFrom(TDigestState.Type.values())); + map.put("digest_type", randomFrom(TDigestExecutionHint.values())); } return map; }); diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapperTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapperTests.java index c72a6e4a84bfa..e84d10e88f461 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapperTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/mapper/TDigestFieldMapperTests.java @@ -16,6 +16,7 @@ import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.tdigest.Centroid; import org.elasticsearch.xcontent.XContentBuilder; @@ -59,7 +60,7 @@ protected void minimalMapping(XContentBuilder b) throws IOException { @Override protected void registerParameters(ParameterChecker checker) throws IOException { checker.registerUpdateCheck(b -> b.field("ignore_malformed", true), m -> assertTrue(m.ignoreMalformed())); - checker.registerConflictCheck("digest_type", b -> b.field("digest_type", TDigestState.Type.AVL_TREE)); + checker.registerConflictCheck("digest_type", b -> b.field("digest_type", TDigestExecutionHint.HIGH_ACCURACY)); checker.registerConflictCheck("compression", b -> b.field("compression", 117)); }