From 75d5168e976ca660c1596c3a6d2118a6e6a848ed Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:40:52 +1100 Subject: [PATCH] [8.x] [ES|QL] Update function metadata (#206386) (#206390) # Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Update function metadata (#206386)](https://github.com/elastic/kibana/pull/206386) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../sections/generated/scalar_functions.tsx | 142 ++++++++++++++++++ .../definitions/generated/scalar_functions.ts | 126 +++++++++++++++- 2 files changed, 265 insertions(+), 3 deletions(-) diff --git a/src/platform/packages/private/kbn-language-documentation/src/sections/generated/scalar_functions.tsx b/src/platform/packages/private/kbn-language-documentation/src/sections/generated/scalar_functions.tsx index f3b27d595f2b0..4d6574bace530 100644 --- a/src/platform/packages/private/kbn-language-documentation/src/sections/generated/scalar_functions.tsx +++ b/src/platform/packages/private/kbn-language-documentation/src/sections/generated/scalar_functions.tsx @@ -995,6 +995,12 @@ export const functions = { ### HASH Computes the hash of the input using various algorithms such as MD5, SHA, SHA-224, SHA-256, SHA-384, SHA-512. + \`\`\` + FROM sample_data + | WHERE message != "Connection error" + | EVAL md5 = hash("md5", message), sha256 = hash("sha256", message) + | KEEP message, md5, sha256; + \`\`\` `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', @@ -1073,6 +1079,40 @@ export const functions = { ), }, // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.kql', { + defaultMessage: 'KQL', + }), + preview: true, + description: ( + + + ### KQL + Performs a KQL query. Returns true if the provided KQL query string matches the row. + + \`\`\` + FROM books + | WHERE KQL("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)', + ignoreTag: true, + })} + /> + ), + }, + // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts { label: i18n.translate('languageDocumentation.documentationESQL.least', { defaultMessage: 'LEAST', @@ -1364,6 +1404,39 @@ export const functions = { ), }, // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.md5', { + defaultMessage: 'MD5', + }), + preview: false, + description: ( + + + ### MD5 + Computes the MD5 hash of the input. + + \`\`\` + FROM sample_data + | WHERE message != "Connection error" + | EVAL md5 = md5(message) + | KEEP message, md5; + \`\`\` + `, + 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.mv_append', { defaultMessage: 'MV_APPEND', @@ -2284,6 +2357,75 @@ export const functions = { | EVAL message = CONCAT("'", message, "'") | EVAL color = CONCAT("'", color, "'") \`\`\` + `, + 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.sha1', { + defaultMessage: 'SHA1', + }), + preview: false, + description: ( + + + ### SHA1 + Computes the SHA1 hash of the input. + + \`\`\` + FROM sample_data + | WHERE message != "Connection error" + | EVAL sha1 = sha1(message) + | KEEP message, sha1; + \`\`\` + `, + 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.sha256', { + defaultMessage: 'SHA256', + }), + preview: false, + description: ( + + + ### SHA256 + Computes the SHA256 hash of the input. + + \`\`\` + FROM sample_data + | WHERE message != "Connection error" + | EVAL sha256 = sha256(message) + | KEEP message, sha256; + \`\`\` `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts index 4837dfbc0413c..87623f9bb0917 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/scalar_functions.ts @@ -2252,7 +2252,9 @@ const hashDefinition: FunctionDefinition = { supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], supportedOptions: ['by'], validate: undefined, - examples: [], + examples: [ + 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL md5 = hash("md5", message), sha256 = hash("sha256", message) \n| KEEP message, md5, sha256;', + ], }; // Do not edit this manually... generated by scripts/generate_function_definitions.ts @@ -2560,8 +2562,6 @@ const kqlDefinition: FunctionDefinition = { defaultMessage: 'Performs a KQL query. Returns true if the provided KQL query string matches the row.', }), - ignoreAsSuggestion: true, - preview: true, alias: undefined, signatures: [ @@ -4002,6 +4002,45 @@ const matchDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const md5Definition: FunctionDefinition = { + type: 'eval', + name: 'md5', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.md5', { + defaultMessage: 'Computes the MD5 hash of the input.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'input', + type: 'keyword', + optional: false, + }, + ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'input', + type: 'text', + optional: false, + }, + ], + returnType: 'keyword', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL md5 = md5(message)\n| KEEP message, md5;', + ], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const mvAppendDefinition: FunctionDefinition = { type: 'eval', @@ -7173,6 +7212,84 @@ const rtrimDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const sha1Definition: FunctionDefinition = { + type: 'eval', + name: 'sha1', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.sha1', { + defaultMessage: 'Computes the SHA1 hash of the input.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'input', + type: 'keyword', + optional: false, + }, + ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'input', + type: 'text', + optional: false, + }, + ], + returnType: 'keyword', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL sha1 = sha1(message)\n| KEEP message, sha1;', + ], +}; + +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const sha256Definition: FunctionDefinition = { + type: 'eval', + name: 'sha256', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.sha256', { + defaultMessage: 'Computes the SHA256 hash of the input.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'input', + type: 'keyword', + optional: false, + }, + ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'input', + type: 'text', + optional: false, + }, + ], + returnType: 'keyword', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL sha256 = sha256(message)\n| KEEP message, sha256;', + ], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const signumDefinition: FunctionDefinition = { type: 'eval', @@ -10519,6 +10636,7 @@ export const scalarFunctionDefinitions = [ log10Definition, ltrimDefinition, matchDefinition, + md5Definition, mvAppendDefinition, mvAvgDefinition, mvConcatDefinition, @@ -10546,6 +10664,8 @@ export const scalarFunctionDefinitions = [ rightDefinition, roundDefinition, rtrimDefinition, + sha1Definition, + sha256Definition, signumDefinition, sinDefinition, sinhDefinition,