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:
Jan Kuipers 2025-06-17 10:56:14 +02:00 committed by GitHub
parent 65cbccc1fd
commit df76c15edd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 66 additions and 0 deletions

View file

@ -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 |

View file

@ -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
:::

View file

@ -9,6 +9,7 @@
* [preview] [`LOOKUP JOIN`](../../commands/processing-commands.md#esql-lookup-join)
* [preview] [`MV_EXPAND`](../../commands/processing-commands.md#esql-mv_expand)
* [`RENAME`](../../commands/processing-commands.md#esql-rename)
* [preview] [`SAMPLE`](../../commands/processing-commands.md#esql-sample)
* [`SORT`](../../commands/processing-commands.md#esql-sort)
* [`STATS`](../../commands/processing-commands.md#esql-stats-by)
* [`WHERE`](../../commands/processing-commands.md#esql-where)

View file

@ -50,6 +50,9 @@ mapped_pages:
:::{include} ../_snippets/commands/layout/rename.md
:::
:::{include} ../_snippets/commands/layout/sample.md
:::
:::{include} ../_snippets/commands/layout/sort.md
:::