-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ES|QL sample documentation #129350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES|QL sample documentation #129350
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| ## `SAMPLE` [esql-sample] | ||
|
|
||
| ::::{warning} | ||
| This functionality is in technical preview and may be | ||
| changed or removed in a future release. Elastic will work to fix any | ||
| issues, but features in technical preview are not subject to the support | ||
| SLA of official GA features. | ||
| :::: | ||
jan-elastic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
| ::: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,3 +221,28 @@ FROM employees | |
| is_expected:boolean | ||
| 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 | ||
|
Comment on lines
+234
to
+238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha, this is beautiful. But I like that we're making sure the syntax is valid, even though the output is not related to the query that's in the docs! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I know. Within the system's current limitations, I don't see anything better than this... |
||
| ; | ||
|
|
||
| // tag::sampleForDocs-result[] | ||
| emp_no:integer | ||
| 10018 | ||
| 10024 | ||
| 10062 | ||
| 10081 | ||
| // end::sampleForDocs-result[] | ||
| ; | ||
Uh oh!
There was an error while loading. Please reload this page.