From e78ba89cc24c744ccd6137e4d53b10e104f2bd96 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:00:34 +1000 Subject: [PATCH] [ES|QL] Update function metadata (#193662) This PR updates the function definitions and inline docs based on the latest metadata from Elasticsearch. Co-authored-by: Stratoula Kalafateli --- .../definitions/generated/scalar_functions.ts | 78 +++++++++++++++++++ .../sections/generated/scalar_functions.tsx | 66 +++++++++++++++- 2 files changed, 142 insertions(+), 2 deletions(-) diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts index 3f5718b5417ba1..aaf6929a4bccf4 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts @@ -517,6 +517,42 @@ const atan2Definition: FunctionDefinition = { examples: ['ROW y=12.9, x=.6\n| EVAL atan2=ATAN2(y, x)'], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const categorizeDefinition: FunctionDefinition = { + type: 'eval', + name: 'categorize', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.categorize', { + defaultMessage: 'Categorizes text messages.', + }), + alias: undefined, + signatures: [ + { + params: [ + { + name: 'field', + type: 'keyword', + optional: false, + }, + ], + returnType: 'integer', + }, + { + params: [ + { + name: 'field', + type: 'text', + optional: false, + }, + ], + returnType: 'integer', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const cbrtDefinition: FunctionDefinition = { type: 'eval', @@ -1256,6 +1292,7 @@ const dateDiffDefinition: FunctionDefinition = { validate: undefined, examples: [ 'ROW date1 = TO_DATETIME("2023-12-02T11:00:00.000Z"), date2 = TO_DATETIME("2023-12-02T11:00:00.001Z")\n| EVAL dd_ms = DATE_DIFF("microseconds", date1, date2)', + 'ROW end_23="2023-12-31T23:59:59.999Z"::DATETIME,\n start_24="2024-01-01T00:00:00.000Z"::DATETIME,\n end_24="2024-12-31T23:59:59.999"::DATETIME\n| EVAL end23_to_start24=DATE_DIFF("year", end_23, start_24)\n| EVAL end23_to_end24=DATE_DIFF("year", end_23, end_24)\n| EVAL start_to_end_24=DATE_DIFF("year", start_24, end_24)', ], }; @@ -5434,6 +5471,45 @@ const powDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const qstrDefinition: FunctionDefinition = { + type: 'eval', + name: 'qstr', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.qstr', { + defaultMessage: + 'Performs a query string query. Returns true if the provided query string matches the row.', + }), + alias: undefined, + signatures: [ + { + params: [ + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'query', + type: 'text', + optional: false, + }, + ], + returnType: 'boolean', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'from books \n| where qstr("author: Faulkner")\n| keep book_no, author \n| sort book_no \n| limit 5;', + ], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const repeatDefinition: FunctionDefinition = { type: 'eval', @@ -8626,6 +8702,7 @@ export const scalarFunctionDefinitions = [ asinDefinition, atanDefinition, atan2Definition, + categorizeDefinition, cbrtDefinition, ceilDefinition, cidrMatchDefinition, @@ -8672,6 +8749,7 @@ export const scalarFunctionDefinitions = [ nowDefinition, piDefinition, powDefinition, + qstrDefinition, repeatDefinition, replaceDefinition, rightDefinition, diff --git a/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx b/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx index 7f736000f03651..21d11e9c22a903 100644 --- a/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx +++ b/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx @@ -256,6 +256,35 @@ export const functions = { ), }, // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.categorize', { + defaultMessage: 'CATEGORIZE', + }), + description: ( + + + ### CATEGORIZE + Categorizes text messages. + + `, + description: + 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', + ignoreTag: true, + } + )} + /> + ), + }, + // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts { label: i18n.translate('languageDocumentation.documentationESQL.cbrt', { defaultMessage: 'CBRT', @@ -1161,7 +1190,7 @@ export const functions = { --> ### MV_AVG - Converts a multivalued field into a single valued field containing the average of all of the values. + Converts a multivalued field into a single valued field containing the average of all the values. \`\`\` ROW a=[3, 5, 1, 6] @@ -1647,7 +1676,7 @@ export const functions = { --> ### MV_SUM - Converts a multivalued field into a single valued field containing the sum of all of the values. + Converts a multivalued field into a single valued field containing the sum of all the values. \`\`\` ROW a=[3, 5, 6] @@ -1777,6 +1806,39 @@ export const functions = { | EVAL result = POW(base, exponent) \`\`\` Note: It is still possible to overflow a double result here; in that case, null will be returned. + `, + description: + 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', + ignoreTag: true, + })} + /> + ), + }, + // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.qstr', { + defaultMessage: 'QSTR', + }), + description: ( + + + ### QSTR + Performs a query string query. Returns true if the provided query string matches the row. + + \`\`\` + from books + | where qstr("author: Faulkner") + | keep book_no, author + | sort book_no + | limit 5; + \`\`\` `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',