From c6a1c3985541d8f8f1ae99bed975ff82a72306db Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Fri, 9 Jan 2026 15:41:07 -0500 Subject: [PATCH 01/11] main field type doc --- .../mapping-reference/t-digest.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 docs/reference/elasticsearch/mapping-reference/t-digest.md 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..0df1dc05545b1 --- /dev/null +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -0,0 +1,98 @@ +--- +applies_to: + stack: preview 9.3 + serverless: preview +navigation_title: "TDigest" +--- + +# 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. This is sent via 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 has the benefit that they can be calculated at +higher accuracy from the raw data. If they are not specified, Elasticsearch +will compute them based on the given `centroids` and `counts`, with some loss of +accuracy. + +::::{important} +* 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 `hybrid`, `avl_tree`, and `merging`. The default is `hybrid`. + +## 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 ES|QL; see the +[ES|QL reference](/reference/query-languages/esql.md) for details. + +## 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 the tdigest doc values. As a result, when indexing a tdigest field in an index with synthetic source enabled, indexing a tdigest including zero-count buckets will result in missing buckets when fetching back the tdigest. +:::: + +## Examples + +Create an index with a `tdigest` field: + +```console +PUT my-index-000001 +{ + "mappings": { + "properties": { + "latency": { + "type": "tdigest" + } + } + } +} +``` + +Indexing a minimal 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] + } +} +``` + From 5fd58cd01a32c86bc728f2f24991f60890a1bfe1 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Fri, 9 Jan 2026 16:07:17 -0500 Subject: [PATCH 02/11] references --- .../elasticsearch/mapping-reference/field-data-types.md | 3 +++ docs/reference/elasticsearch/toc.yml | 1 + docs/reference/query-languages/esql/limitations.md | 1 + 3 files changed, 5 insertions(+) diff --git a/docs/reference/elasticsearch/mapping-reference/field-data-types.md b/docs/reference/elasticsearch/mapping-reference/field-data-types.md index 17a98684f2b7b..fd2d35b50493b 100644 --- a/docs/reference/elasticsearch/mapping-reference/field-data-types.md +++ b/docs/reference/elasticsearch/mapping-reference/field-data-types.md @@ -80,6 +80,9 @@ Dates [`exponential_histogram`](/reference/elasticsearch/mapping-reference/exponential-histogram.md) : Pre-aggregated numerical values in the form of an exponential histogram. +[`tdigest`](/reference/elasticsearch/mapping-reference/t-digest.md) +: Pre-aggregated numerical values in the form of a T-Digest. + ### Text search types [text-search-types] diff --git a/docs/reference/elasticsearch/toc.yml b/docs/reference/elasticsearch/toc.yml index b7744af86d017..5fae1f0831985 100644 --- a/docs/reference/elasticsearch/toc.yml +++ b/docs/reference/elasticsearch/toc.yml @@ -159,6 +159,7 @@ toc: - 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 e3b21855cbdd0..30a1303b173ef 100644 --- a/docs/reference/query-languages/esql/limitations.md +++ b/docs/reference/query-languages/esql/limitations.md @@ -52,6 +52,7 @@ By default, an {{esql}} query returns up to 1,000 rows. You can increase the num * `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] From ae59b371d60a42275d537a4b067dec0de02a79c4 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Tue, 20 Jan 2026 13:05:22 -0500 Subject: [PATCH 03/11] Apply suggestions from code review Co-authored-by: Liam Thompson --- .../mapping-reference/t-digest.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/reference/elasticsearch/mapping-reference/t-digest.md b/docs/reference/elasticsearch/mapping-reference/t-digest.md index 0df1dc05545b1..4cda46b0c0966 100644 --- a/docs/reference/elasticsearch/mapping-reference/t-digest.md +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -2,12 +2,16 @@ applies_to: stack: preview 9.3 serverless: preview -navigation_title: "TDigest" +navigation_title: "T-digest" --- -# T-Digest Field Type [tdigest] +# 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. This is sent via two arrays: +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 @@ -26,9 +30,9 @@ The field also accepts three optional summary fields: * `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 has the benefit that they can be calculated at -higher accuracy from the raw data. If they are not specified, Elasticsearch -will compute them based on the given `centroids` and `counts`, with some loss of +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. ::::{important} @@ -65,12 +69,12 @@ indexed. `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 the tdigest doc values. As a result, when indexing a tdigest field in an index with synthetic source enabled, indexing a tdigest including zero-count buckets will result in missing buckets when fetching back the tdigest. +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: +### Create an index with a `tdigest` field ```console PUT my-index-000001 @@ -85,7 +89,7 @@ PUT my-index-000001 } ``` -Indexing a minimal document +### Index a simple document ```console PUT my-index-000001/_doc/1 { From f5902308a50b940a5f1622c1665db578a2df8ead Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Tue, 20 Jan 2026 13:05:52 -0500 Subject: [PATCH 04/11] Update docs/reference/elasticsearch/mapping-reference/field-data-types.md Co-authored-by: Liam Thompson --- .../elasticsearch/mapping-reference/field-data-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/elasticsearch/mapping-reference/field-data-types.md b/docs/reference/elasticsearch/mapping-reference/field-data-types.md index fd2d35b50493b..c2dc570201d77 100644 --- a/docs/reference/elasticsearch/mapping-reference/field-data-types.md +++ b/docs/reference/elasticsearch/mapping-reference/field-data-types.md @@ -80,7 +80,7 @@ Dates [`exponential_histogram`](/reference/elasticsearch/mapping-reference/exponential-histogram.md) : Pre-aggregated numerical values in the form of an exponential histogram. -[`tdigest`](/reference/elasticsearch/mapping-reference/t-digest.md) +[`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. From 612c15128a8ecf6dc076a8ee2f49b44a194b885f Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Tue, 20 Jan 2026 13:19:33 -0500 Subject: [PATCH 05/11] Update docs/changelog/140478.yaml --- docs/changelog/140478.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/140478.yaml 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: [] From d920edbb567524e0753dc01b61968b980d90cef6 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Tue, 20 Jan 2026 13:22:57 -0500 Subject: [PATCH 06/11] requeted changes --- .../mapping-reference/t-digest.md | 24 ++++++++++++++++--- .../analytics/mapper/TDigestFieldMapper.java | 11 +++++---- .../mapper/TDigestFieldBlockLoaderTests.java | 3 ++- .../mapper/TDigestFieldMapperTests.java | 3 ++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/docs/reference/elasticsearch/mapping-reference/t-digest.md b/docs/reference/elasticsearch/mapping-reference/t-digest.md index 4cda46b0c0966..da2c3c05ce4c8 100644 --- a/docs/reference/elasticsearch/mapping-reference/t-digest.md +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -52,7 +52,7 @@ T-Digest fields accept two field-specific configuration parameters: 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 `hybrid`, `avl_tree`, and `merging`. The default is `hybrid`. + values are `default` and `high_accuracy`. The default is `default`. ## Use cases [tdigest-use-cases] @@ -61,8 +61,16 @@ 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 ES|QL; see the -[ES|QL reference](/reference/query-languages/esql.md) for details. +`tdigest` fields are supported in the following [ES|QL](/reference/query-languages/esql.md) aggregation functions: + +* [Avg](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-avg) +* [Max](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-max) + and + [Min](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-min) +* [Percentile](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-percentile) +* [Present](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-present) and + [Absent](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-absent) + ## Synthetic `_source` [tdigest-synthetic-source] @@ -90,6 +98,7 @@ PUT my-index-000001 ``` ### Index a simple document + ```console PUT my-index-000001/_doc/1 { @@ -100,3 +109,12 @@ PUT my-index-000001/_doc/1 } ``` +### Query via ES|QL + +```console +POST /_query?format=txt +{ + "query": "FROM test | STATS Percentile(99, latency)" +} + + 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..fb4f74b30dad6 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,6 +51,7 @@ import org.elasticsearch.script.field.DocValuesScriptFieldFactory; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; +import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.search.sort.BucketedSort; import org.elasticsearch.search.sort.SortOrder; @@ -89,7 +90,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 +105,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 +148,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 +164,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..1329f6fffdfee 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,6 +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.TDigestExecutionHint; import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.analytics.AnalyticsPlugin; @@ -55,7 +56,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)); } From a5de40857188e3bcbcd55a1f9bbdaabc0b7a714b Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Tue, 20 Jan 2026 18:31:01 +0000 Subject: [PATCH 07/11] [CI] Auto commit changes from spotless --- .../elasticsearch/xpack/analytics/mapper/TDigestFieldMapper.java | 1 - .../xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java | 1 - 2 files changed, 2 deletions(-) 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 fb4f74b30dad6..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 @@ -52,7 +52,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; -import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.search.sort.BucketedSort; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.tdigest.parsing.TDigestParser; 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 1329f6fffdfee..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 @@ -15,7 +15,6 @@ import org.elasticsearch.index.mapper.BlockLoaderTestCase; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; -import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.analytics.AnalyticsPlugin; From 2bf78a7a8fbd68595fbdd0ba2cdf8e3e2abb4a52 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Tue, 20 Jan 2026 13:32:17 -0500 Subject: [PATCH 08/11] spotless apply --- .../elasticsearch/xpack/analytics/mapper/TDigestFieldMapper.java | 1 - .../xpack/analytics/mapper/TDigestFieldBlockLoaderTests.java | 1 - 2 files changed, 2 deletions(-) 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 fb4f74b30dad6..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 @@ -52,7 +52,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; -import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.search.sort.BucketedSort; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.tdigest.parsing.TDigestParser; 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 1329f6fffdfee..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 @@ -15,7 +15,6 @@ import org.elasticsearch.index.mapper.BlockLoaderTestCase; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.aggregations.metrics.TDigestExecutionHint; -import org.elasticsearch.search.aggregations.metrics.TDigestState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.analytics.AnalyticsPlugin; From 2e7423abb0c7e9f0eba39824e770f9f0483a2b6c Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Wed, 21 Jan 2026 08:46:46 -0500 Subject: [PATCH 09/11] requeted changes --- .../elasticsearch/mapping-reference/t-digest.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/reference/elasticsearch/mapping-reference/t-digest.md b/docs/reference/elasticsearch/mapping-reference/t-digest.md index da2c3c05ce4c8..4137226caf538 100644 --- a/docs/reference/elasticsearch/mapping-reference/t-digest.md +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -52,7 +52,10 @@ T-Digest fields accept two field-specific configuration parameters: 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`. + 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 and disk for + a better approximation. ## Use cases [tdigest-use-cases] @@ -63,13 +66,13 @@ indexed. `tdigest` fields are supported in the following [ES|QL](/reference/query-languages/esql.md) aggregation functions: -* [Avg](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-avg) -* [Max](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-max) +* [Avg](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-avg) +* [Max](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-max) and - [Min](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-min) -* [Percentile](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-percentile) -* [Present](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-present) and - [Absent](https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/aggregation-functions#esql-absent) + [Min](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-min) +* [Percentile](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-percentile) +* [Present](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-present) and + [Absent](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-absent) ## Synthetic `_source` [tdigest-synthetic-source] From c5b6014674a1b1b86e9553bb835c19f60e002166 Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Wed, 21 Jan 2026 09:04:04 -0500 Subject: [PATCH 10/11] fix internal links --- .../elasticsearch/mapping-reference/t-digest.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/elasticsearch/mapping-reference/t-digest.md b/docs/reference/elasticsearch/mapping-reference/t-digest.md index 4137226caf538..d403c3323536b 100644 --- a/docs/reference/elasticsearch/mapping-reference/t-digest.md +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -66,13 +66,13 @@ 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#esql-avg) -* [Max](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-max) +* [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#esql-min) -* [Percentile](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-percentile) -* [Present](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-present) and - [Absent](/reference/query-languages/esql/functions-operators/aggregation-functions#esql-absent) + [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] From 80cb581f629b41be52f3f101129c284bd348f4fa Mon Sep 17 00:00:00 2001 From: Mark Tozzi Date: Fri, 23 Jan 2026 14:23:40 -0500 Subject: [PATCH 11/11] requeted changes --- .../mapping-reference/exponential-histogram.md | 4 ++-- .../reference/elasticsearch/mapping-reference/t-digest.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md b/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md index 903cbaaad9d98..48a9250463207 100644 --- a/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md +++ b/docs/reference/elasticsearch/mapping-reference/exponential-histogram.md @@ -59,10 +59,10 @@ Optionally, you can include precomputed summary statistics: 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`. -::::{important} +## 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] diff --git a/docs/reference/elasticsearch/mapping-reference/t-digest.md b/docs/reference/elasticsearch/mapping-reference/t-digest.md index d403c3323536b..410c495f981f1 100644 --- a/docs/reference/elasticsearch/mapping-reference/t-digest.md +++ b/docs/reference/elasticsearch/mapping-reference/t-digest.md @@ -35,11 +35,11 @@ higher accuracy from the raw data. If not specified, Elasticsearch computes them based on the given `centroids` and `counts`, with some loss of accuracy. -::::{important} +## 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 @@ -54,8 +54,8 @@ T-Digest fields accept two field-specific configuration parameters: * `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 and disk for - a better approximation. + good approximation. The `high_accuracy` variant uses more memory, disk, and + CPU for a better approximation. ## Use cases [tdigest-use-cases]