mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-29 01:44:36 -04:00
ES|QL sample documentation (#129350)
* ES|QL sample documentation * Update docs/reference/query-languages/esql/_snippets/commands/layout/sample.md Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> --------- Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
This commit is contained in:
parent
65cbccc1fd
commit
df76c15edd
5 changed files with 66 additions and 0 deletions
|
@ -0,0 +1,14 @@
|
||||||
|
% This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
|
||||||
|
|
||||||
|
```esql
|
||||||
|
FROM employees
|
||||||
|
| KEEP emp_no
|
||||||
|
| SAMPLE 0.05
|
||||||
|
```
|
||||||
|
|
||||||
|
| emp_no:integer |
|
||||||
|
| --- |
|
||||||
|
| 10018 |
|
||||||
|
| 10024 |
|
||||||
|
| 10062 |
|
||||||
|
| 10081 |
|
|
@ -0,0 +1,23 @@
|
||||||
|
## `SAMPLE` [esql-sample]
|
||||||
|
|
||||||
|
```yaml {applies_to}
|
||||||
|
stack: preview 9.1
|
||||||
|
```
|
||||||
|
|
||||||
|
The `SAMPLE` command samples a fraction of the table rows.
|
||||||
|
|
||||||
|
**Syntax**
|
||||||
|
|
||||||
|
```esql
|
||||||
|
SAMPLE probability
|
||||||
|
```
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
`probability`
|
||||||
|
: The probability that a row is included in the sample. The value must be between 0 and 1, exclusive.
|
||||||
|
|
||||||
|
**Examples**
|
||||||
|
|
||||||
|
:::{include} ../examples/sample.csv-spec/sampleForDocs.md
|
||||||
|
:::
|
|
@ -9,6 +9,7 @@
|
||||||
* [preview] [`LOOKUP JOIN`](../../commands/processing-commands.md#esql-lookup-join)
|
* [preview] [`LOOKUP JOIN`](../../commands/processing-commands.md#esql-lookup-join)
|
||||||
* [preview] [`MV_EXPAND`](../../commands/processing-commands.md#esql-mv_expand)
|
* [preview] [`MV_EXPAND`](../../commands/processing-commands.md#esql-mv_expand)
|
||||||
* [`RENAME`](../../commands/processing-commands.md#esql-rename)
|
* [`RENAME`](../../commands/processing-commands.md#esql-rename)
|
||||||
|
* [preview] [`SAMPLE`](../../commands/processing-commands.md#esql-sample)
|
||||||
* [`SORT`](../../commands/processing-commands.md#esql-sort)
|
* [`SORT`](../../commands/processing-commands.md#esql-sort)
|
||||||
* [`STATS`](../../commands/processing-commands.md#esql-stats-by)
|
* [`STATS`](../../commands/processing-commands.md#esql-stats-by)
|
||||||
* [`WHERE`](../../commands/processing-commands.md#esql-where)
|
* [`WHERE`](../../commands/processing-commands.md#esql-where)
|
||||||
|
|
|
@ -50,6 +50,9 @@ mapped_pages:
|
||||||
:::{include} ../_snippets/commands/layout/rename.md
|
:::{include} ../_snippets/commands/layout/rename.md
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
:::{include} ../_snippets/commands/layout/sample.md
|
||||||
|
:::
|
||||||
|
|
||||||
:::{include} ../_snippets/commands/layout/sort.md
|
:::{include} ../_snippets/commands/layout/sort.md
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
|
@ -221,3 +221,28 @@ FROM employees
|
||||||
is_expected:boolean
|
is_expected:boolean
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
example for docs
|
||||||
|
required_capability: sample_v3
|
||||||
|
|
||||||
|
// tag::sampleForDocs[]
|
||||||
|
FROM employees
|
||||||
|
| KEEP emp_no
|
||||||
|
| SAMPLE 0.05
|
||||||
|
// end::sampleForDocs[]
|
||||||
|
// Hardcode the sample values to work around the limitations of the CSV tests in the
|
||||||
|
// presence of randomness, and be able to specify an expected result for the docs.
|
||||||
|
| STATS emp_no = COUNT()
|
||||||
|
| EVAL emp_no = [10018, 10024, 10062, 10081]
|
||||||
|
| MV_EXPAND emp_no
|
||||||
|
;
|
||||||
|
|
||||||
|
// tag::sampleForDocs-result[]
|
||||||
|
emp_no:integer
|
||||||
|
10018
|
||||||
|
10024
|
||||||
|
10062
|
||||||
|
10081
|
||||||
|
// end::sampleForDocs-result[]
|
||||||
|
;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue