Skip to content

Commit bfb4c4d

Browse files
authored
Merge branch '9.0' into backport/9.0/pr-124755
2 parents 5307bad + 8a8e641 commit bfb4c4d

File tree

929 files changed

+4551
-18848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

929 files changed

+4551
-18848
lines changed

.gitattributes

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBasePar
1313
x-pack/plugin/esql/src/main/generated/** linguist-generated=true
1414
x-pack/plugin/esql/src/main/generated-src/** linguist-generated=true
1515

16-
# ESQL functions docs are autogenerated. More information at `docs/reference/esql/functions/README.md`
17-
docs/reference/esql/functions/*/** linguist-generated=true
16+
# ESQL functions docs are autogenerated. More information at `docs/reference/query-languages/esql/README.md`
17+
docs/reference/query-languages/esql/_snippets/functions/*/** linguist-generated=true
18+
#docs/reference/query-languages/esql/_snippets/operators/*/** linguist-generated=true
19+
docs/reference/query-languages/esql/images/** linguist-generated=true
20+
docs/reference/query-languages/esql/kibana/** linguist-generated=true
1821

docs/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ testClusters.matching { it.name == "yamlRestTest"}.configureEach {
121121

122122
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
123123
systemProperty 'es.transport.cname_in_publish_address', 'true'
124+
systemProperty 'es.queryable_built_in_roles_enabled', 'false'
124125

125126

126127
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")

docs/changelog/124544.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 124544
2+
summary: Bump nimbus-jose-jwt to 10.0.2
3+
area: Security
4+
type: upgrade
5+
issues: []

docs/changelog/124739.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 124739
2+
summary: Improve rolling up metrics
3+
area: Downsampling
4+
type: enhancement
5+
issues: []

docs/changelog/124769.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 124769
2+
summary: Migrate `model_version` to `model_id` when parsing persistent elser inference
3+
endpoints
4+
area: Machine Learning
5+
type: bug
6+
issues:
7+
- 124675

docs/docset.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ project: 'Elasticsearch'
22
exclude:
33
- README.md
44
- internal/*
5-
- reference/esql/functions/kibana/docs/*
6-
- reference/esql/functions/README.md
5+
- reference/query-languages/esql/kibana/docs/**
6+
- reference/query-languages/esql/README.md
77
cross_links:
88
- beats
99
- cloud
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* configurable precision, which decides on how to trade memory for accuracy,
2+
* excellent accuracy on low-cardinality sets,
3+
* fixed memory usage: no matter if there are tens or billions of unique values, memory usage only depends on the configured precision.
4+
5+
For a precision threshold of `c`, the implementation that we are using requires about `c * 8` bytes.
6+
7+
The following chart shows how the error varies before and after the threshold:
8+
9+
![cardinality error](/images/cardinality_error.png "")
10+
11+
For all 3 thresholds, counts have been accurate up to the configured threshold. Although not guaranteed,
12+
this is likely to be the case. Accuracy in practice depends on the dataset in question. In general,
13+
most datasets show consistently good accuracy. Also note that even with a threshold as low as 100,
14+
the error remains very low (1-6% as seen in the above graph) even when counting millions of items.
15+
16+
The HyperLogLog++ algorithm depends on the leading zeros of hashed values, the exact distributions of
17+
hashes in a dataset can affect the accuracy of the cardinality.
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,3 @@
1-
## `PERCENTILE` [esql-percentile]
2-
3-
**Syntax**
4-
5-
:::{image} ../../../../../images/percentile.svg
6-
:alt: Embedded
7-
:class: text-center
8-
:::
9-
10-
**Parameters**
11-
12-
true
13-
**Description**
14-
15-
Returns the value at which a certain percentage of observed values occur. For example, the 95th percentile is the value which is greater than 95% of the observed values and the 50th percentile is the `MEDIAN`.
16-
17-
**Supported types**
18-
19-
| number | percentile | result |
20-
| --- | --- | --- |
21-
| double | double | double |
22-
| double | integer | double |
23-
| double | long | double |
24-
| integer | double | double |
25-
| integer | integer | double |
26-
| integer | long | double |
27-
| long | double | double |
28-
| long | integer | double |
29-
| long | long | double |
30-
31-
**Examples**
32-
33-
```esql
34-
FROM employees
35-
| STATS p0 = PERCENTILE(salary, 0)
36-
, p50 = PERCENTILE(salary, 50)
37-
, p99 = PERCENTILE(salary, 99)
38-
```
39-
40-
| p0:double | p50:double | p99:double |
41-
| --- | --- | --- |
42-
| 25324 | 47003 | 74970.29 |
43-
44-
The expression can use inline functions. For example, to calculate a percentile of the maximum values of a multivalued column, first use `MV_MAX` to get the maximum value per row, and use the result with the `PERCENTILE` function
45-
46-
```esql
47-
FROM employees
48-
| STATS p80_max_salary_change = PERCENTILE(MV_MAX(salary_change), 80)
49-
```
50-
51-
| p80_max_salary_change:double |
52-
| --- |
53-
| 12.132 |
54-
55-
56-
### `PERCENTILE` is (usually) approximate [esql-percentile-approximate]
57-
581
There are many different algorithms to calculate percentiles. The naive implementation simply stores all the values in a sorted array. To find the 50th percentile, you simply find the value that is at `my_array[count(my_array) * 0.5]`.
592

603
Clearly, the naive implementation does not scale — the sorted array grows linearly with the number of values in your dataset. To calculate percentiles across potentially billions of values in an Elasticsearch cluster, *approximate* percentiles are calculated.
@@ -72,11 +15,3 @@ The following chart shows the relative error on a uniform distribution depending
7215
![percentiles error](/images/percentiles_error.png "")
7316

7417
It shows how precision is better for extreme percentiles. The reason why error diminishes for large number of values is that the law of large numbers makes the distribution of values more and more uniform and the t-digest tree can do a better job at summarizing it. It would not be the case on more skewed distributions.
75-
76-
::::{warning}
77-
`PERCENTILE` is also [non-deterministic](https://en.wikipedia.org/wiki/Nondeterministic_algorithm). This means you can get slightly different results using the same data.
78-
79-
::::
80-
81-
82-

docs/reference/data-analysis/aggregations/search-aggregations-metrics-cardinality-aggregation.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,8 @@ Computing exact counts requires loading values into a hash set and returning its
6565

6666
This `cardinality` aggregation is based on the [HyperLogLog++](https://static.googleusercontent.com/media/research.google.com/fr//pubs/archive/40671.pdf) algorithm, which counts based on the hashes of the values with some interesting properties:
6767

68-
* configurable precision, which decides on how to trade memory for accuracy,
69-
* excellent accuracy on low-cardinality sets,
70-
* fixed memory usage: no matter if there are tens or billions of unique values, memory usage only depends on the configured precision.
71-
72-
For a precision threshold of `c`, the implementation that we are using requires about `c * 8` bytes.
73-
74-
The following chart shows how the error varies before and after the threshold:
75-
76-
![cardinality error](../../../images/cardinality_error.png "")
77-
78-
For all 3 thresholds, counts have been accurate up to the configured threshold. Although not guaranteed, this is likely to be the case. Accuracy in practice depends on the dataset in question. In general, most datasets show consistently good accuracy. Also note that even with a threshold as low as 100, the error remains very low (1-6% as seen in the above graph) even when counting millions of items.
79-
80-
The HyperLogLog++ algorithm depends on the leading zeros of hashed values, the exact distributions of hashes in a dataset can affect the accuracy of the cardinality.
68+
:::{include} _snippets/search-aggregations-metrics-cardinality-aggregation-explanation.md
69+
:::
8170

8271

8372
## Pre-computed hashes [_pre_computed_hashes]

docs/reference/data-analysis/aggregations/search-aggregations-metrics-percentile-aggregation.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -175,31 +175,14 @@ GET latency/_search
175175

176176
## Percentiles are (usually) approximate [search-aggregations-metrics-percentile-aggregation-approximation]
177177

178-
There are many different algorithms to calculate percentiles. The naive implementation simply stores all the values in a sorted array. To find the 50th percentile, you simply find the value that is at `my_array[count(my_array) * 0.5]`.
179-
180-
Clearly, the naive implementation does not scale — the sorted array grows linearly with the number of values in your dataset. To calculate percentiles across potentially billions of values in an Elasticsearch cluster, *approximate* percentiles are calculated.
181-
182-
The algorithm used by the `percentile` metric is called TDigest (introduced by Ted Dunning in [Computing Accurate Quantiles using T-Digests](https://github.com/tdunning/t-digest/blob/master/docs/t-digest-paper/histo.pdf)).
183-
184-
When using this metric, there are a few guidelines to keep in mind:
185-
186-
* Accuracy is proportional to `q(1-q)`. This means that extreme percentiles (e.g. 99%) are more accurate than less extreme percentiles, such as the median
187-
* For small sets of values, percentiles are highly accurate (and potentially 100% accurate if the data is small enough).
188-
* As the quantity of values in a bucket grows, the algorithm begins to approximate the percentiles. It is effectively trading accuracy for memory savings. The exact level of inaccuracy is difficult to generalize, since it depends on your data distribution and volume of data being aggregated
189-
190-
The following chart shows the relative error on a uniform distribution depending on the number of collected values and the requested percentile:
191-
192-
![percentiles error](../../../images/percentiles_error.png "")
193-
194-
It shows how precision is better for extreme percentiles. The reason why error diminishes for large number of values is that the law of large numbers makes the distribution of values more and more uniform and the t-digest tree can do a better job at summarizing it. It would not be the case on more skewed distributions.
178+
:::{include} /reference/data-analysis/aggregations/_snippets/search-aggregations-metrics-percentile-aggregation-approximate.md
179+
:::
195180

196181
::::{warning}
197182
Percentile aggregations are also [non-deterministic](https://en.wikipedia.org/wiki/Nondeterministic_algorithm). This means you can get slightly different results using the same data.
198-
199183
::::
200184

201185

202-
203186
## Compression [search-aggregations-metrics-percentile-aggregation-compression]
204187

205188
Approximate algorithms must balance memory utilization with estimation accuracy. This balance can be controlled using a `compression` parameter:

0 commit comments

Comments
 (0)