diff --git a/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx b/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx index 015875f977c65..bc818a90ca05f 100644 --- a/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx +++ b/packages/kbn-text-based-editor/src/esql_documentation_sections.tsx @@ -106,6 +106,16 @@ Also, similar to the index fields, once an aggregation is performed, a metadata FROM employees [METADATA _index, _id] | STATS max = MAX(emp_no) BY _index \`\`\` + +The \`OPTIONS\` directive of the FROM command allows you to configure the way ES|QL accesses the data to be queried. The argument passed to this directive is a comma-separated list of option name-value pairs, with the option name and the corresponding value double-quoted. + +For example: + +\`\`\` +FROM index_pattern [OPTIONS "option1"="value1"[,...[,"optionN"="valueN"]]] +\`\`\` + +Learn more about the \`OPTIONS\` directive in the [main documentation page](https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-index-options.html#esql-index-options). `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', @@ -870,7 +880,7 @@ ROW y=12.9, x=.6 label: i18n.translate( 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.autoBucketFunction', { - defaultMessage: 'AUTO_BUCKET', + defaultMessage: 'BUCKET', } ), description: ( @@ -879,14 +889,14 @@ ROW y=12.9, x=.6 markdownContent={i18n.translate( 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.autoBucketFunction.markdown', { - defaultMessage: `### AUTO_BUCKET -Creates human-friendly buckets and returns a \`datetime\` value for each row that corresponds to the resulting bucket the row falls into. Combine \`AUTO_BUCKET\`with \`STATS ... BY\` to create a date histogram. + defaultMessage: `### BUCKET +Creates human-friendly buckets and returns a \`datetime\` value for each row that corresponds to the resulting bucket the row falls into. Combine \`BUCKET\`with \`STATS ... BY\` to create a date histogram. You provide a target number of buckets, a start date, and an end date, and it picks an appropriate bucket size to generate the target number of buckets or fewer. For example, this asks for at most 20 buckets over a whole year, which picks monthly buckets: \`\`\` ROW date=TO_DATETIME("1985-07-09T00:00:00.000Z") -| EVAL bucket=AUTO_BUCKET(date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") +| EVAL bucket=BUCKET(date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") \`\`\` Returning: @@ -898,12 +908,12 @@ The goal isn't to provide *exactly* the target number of buckets, it's to pick a range that people are comfortable with that provides at most the target number of buckets. -If you ask for more buckets then \`AUTO_BUCKET\` can pick a smaller range. For example, +If you ask for more buckets then \`BUCKET\` can pick a smaller range. For example, asking for at most 100 buckets in a year will get you week long buckets: \`\`\` ROW date=TO_DATETIME("1985-07-09T00:00:00.000Z") -| EVAL bucket=AUTO_BUCKET(date, 100, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") +| EVAL bucket=BUCKET(date, 100, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") \`\`\` Returning: @@ -911,14 +921,14 @@ Returning: 1985-07-09T00:00:00.000Z | 1985-07-08T00:00:00.000Z \`\`\` -\`AUTO_BUCKET\` does not filter any rows. It only uses the provided time range to pick a good bucket size. For rows with a date outside of the range, it returns a datetime that corresponds to a bucket outside the range. Combine \`AUTO_BUCKET\` with \`WHERE\` to filter rows. +\`BUCKET\` does not filter any rows. It only uses the provided time range to pick a good bucket size. For rows with a date outside of the range, it returns a datetime that corresponds to a bucket outside the range. Combine \`BUCKET\` with \`WHERE\` to filter rows. A more complete example might look like: \`\`\` FROM employees | WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z" -| EVAL bucket = AUTO_BUCKET(hire_date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") +| EVAL bucket = BUCKET(hire_date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z") | STATS AVG(salary) BY bucket | SORT bucket \`\`\` @@ -933,7 +943,7 @@ Returning: 54539.75 | 1985-11-01T00:00:00.000 \`\`\` -NOTE: \`AUTO_BUCKET\` does not create buckets that don’t match any documents. That’s why the example above is missing 1985-03-01 and other dates. +NOTE: \`BUCKET\` does not create buckets that don’t match any documents. That’s why the example above is missing 1985-03-01 and other dates. `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', @@ -1785,6 +1795,40 @@ The order that [multivalued fields](https://www.elastic.co/guide/en/elasticsearc /> ), }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvLastFunction', + { + defaultMessage: 'MV_LAST', + } + ), + description: ( + + ), + }, { label: i18n.translate( 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvMaxFunction', @@ -1926,6 +1970,71 @@ Returning: /> ), }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvSortFunction', + { + defaultMessage: 'MV_SORT', + } + ), + description: ( + + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvSliceFunction', + { + defaultMessage: 'MV_SLICE', + } + ), + description: ( + + ), + }, { label: i18n.translate( 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvSumFunction', @@ -1963,31 +2072,33 @@ NOTE: The input type can be any number and the output type is the same as the in }, { label: i18n.translate( - 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvLastFunction', + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.mvZipFunction', { - defaultMessage: 'MV_LAST', + defaultMessage: 'MV_ZIP', } ), description: ( + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.signumFunction', + { + defaultMessage: 'SIGNUM', + } + ), + description: ( + + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.valuesFunction', + { + defaultMessage: 'VALUES', + } + ), + description: ( + _**WARNING:** This can use a significant amount of memory and ES|QL doesn’t yet grow aggregations beyond memory. So this aggregation will work until it is used to collect more values than can fit into memory. Once it collects too many values it will fail the query with a [Circuit Breaker Error](https://www.elastic.co/guide/en/elasticsearch/reference/current/circuit-breaker-errors.html)._ + + `, + description: + 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', + } + )} + /> + ), + }, + ], +}; + +export const spatialFunctions = { + label: i18n.translate('textBasedEditor.query.textBasedLanguagesEditor.spatialFunctions', { + defaultMessage: 'Spatial functions', + }), + description: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.spatialFunctionsDocumentationESQLDescription', + { + defaultMessage: `ES|QL supports these spatial functions:`, + } + ), + items: [ + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.stcontainsFunction', + { + defaultMessage: 'ST_CONTAINS', + } + ), + description: ( + + ), + }, + // ST_DISJOINT + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.stdisjointFunction', + { + defaultMessage: 'ST_DISJOINT', + } + ), + description: ( + + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.stintersectsFunction', + { + defaultMessage: 'ST_INTERSECTS', + } + ), + description: ( + + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.stwithinFunction', + { + defaultMessage: 'ST_WITHIN', + } + ), + description: ( + + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.stxFunction', + { + defaultMessage: 'ST_X', + } + ), + description: ( + + ), + }, + { + label: i18n.translate( + 'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.styFunction', + { + defaultMessage: 'ST_Y', + } + ), + description: ( + \` -* larger than or equal: \`>=\` +* greater than: \`>\` +* greater than or equal: \`>=\` +* add: \`+\` +* subtract: \`-\` +* multiply: \`*\` +* divide: \`/\` +* modulus: \`%\` `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', diff --git a/packages/kbn-text-based-editor/src/helpers.ts b/packages/kbn-text-based-editor/src/helpers.ts index 3d5a3290fc8e5..8de329d980f06 100644 --- a/packages/kbn-text-based-editor/src/helpers.ts +++ b/packages/kbn-text-based-editor/src/helpers.ts @@ -156,6 +156,7 @@ export const getDocumentationSections = async (language: string) => { initialSection, functions, aggregationFunctions, + spatialFunctions, operators, } = await import('./esql_documentation_sections'); groups.push({ @@ -164,7 +165,14 @@ export const getDocumentationSections = async (language: string) => { }), items: [], }); - groups.push(sourceCommands, processingCommands, functions, aggregationFunctions, operators); + groups.push( + sourceCommands, + processingCommands, + functions, + aggregationFunctions, + spatialFunctions, + operators + ); return { groups, initialSection, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 53ffc6b3fe3aa..af90acff2f6bf 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -45111,4 +45111,4 @@ "xpack.serverlessObservability.nav.projectSettings": "Paramètres de projet", "xpack.serverlessObservability.nav.synthetics": "Synthetics" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index e857cc1f67757..43e26d51490ca 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -45081,4 +45081,4 @@ "xpack.serverlessObservability.nav.projectSettings": "プロジェクト設定", "xpack.serverlessObservability.nav.synthetics": "Synthetics" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 405fa65c8f6fd..9a78d068ef0d1 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -45129,4 +45129,4 @@ "xpack.serverlessObservability.nav.projectSettings": "项目设置", "xpack.serverlessObservability.nav.synthetics": "Synthetics" } -} \ No newline at end of file +}