From 2cd6dc3ff17374901189916a3a042cb8add433ed Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Fri, 6 Dec 2024 14:40:47 +0100 Subject: [PATCH] [ES|QL] Generate docs and functions (#203210) ## Summary Updates the docs and functions from ES --- .../definitions/generated/scalar_functions.ts | 393 +++++++++++++++++- .../sections/generated/scalar_functions.tsx | 222 ++++++++++ 2 files changed, 610 insertions(+), 5 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 d76b4d9b03ad9..20e3fe964722b 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 @@ -605,11 +605,9 @@ const categorizeDefinition: FunctionDefinition = { type: 'eval', name: 'categorize', description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.categorize', { - defaultMessage: 'Categorizes text messages.', + defaultMessage: 'Groups text messages into categories of similarly formatted text values.', }), - ignoreAsSuggestion: true, - - preview: false, + preview: true, alias: undefined, signatures: [ { @@ -636,7 +634,7 @@ const categorizeDefinition: FunctionDefinition = { supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], supportedOptions: ['by'], validate: undefined, - examples: [], + examples: ['FROM sample_data\n| STATS count=COUNT() BY category=CATEGORIZE(message)'], }; // Do not edit this manually... generated by scripts/generate_function_definitions.ts @@ -7361,6 +7359,65 @@ const stDistanceDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const stEnvelopeDefinition: FunctionDefinition = { + type: 'eval', + name: 'st_envelope', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_envelope', { + defaultMessage: 'Determines the minimum bounding box of the supplied geometry.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'geometry', + type: 'cartesian_point', + optional: false, + }, + ], + returnType: 'cartesian_shape', + }, + { + params: [ + { + name: 'geometry', + type: 'cartesian_shape', + optional: false, + }, + ], + returnType: 'cartesian_shape', + }, + { + params: [ + { + name: 'geometry', + type: 'geo_point', + optional: false, + }, + ], + returnType: 'geo_shape', + }, + { + params: [ + { + name: 'geometry', + type: 'geo_shape', + optional: false, + }, + ], + returnType: 'geo_shape', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM airport_city_boundaries\n| WHERE abbrev == "CPH"\n| EVAL envelope = ST_ENVELOPE(city_boundary)\n| KEEP abbrev, airport, envelope', + ], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const stIntersectsDefinition: FunctionDefinition = { type: 'eval', @@ -7681,6 +7738,126 @@ const stXDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const stXmaxDefinition: FunctionDefinition = { + type: 'eval', + name: 'st_xmax', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_xmax', { + defaultMessage: + 'Extracts the maximum value of the `x` coordinates from the supplied geometry.\nIf the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the maximum `longitude` value.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'point', + type: 'cartesian_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'cartesian_shape', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_shape', + optional: false, + }, + ], + returnType: 'double', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM airport_city_boundaries\n| WHERE abbrev == "CPH"\n| EVAL envelope = ST_ENVELOPE(city_boundary)\n| EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope)\n| KEEP abbrev, airport, xmin, xmax, ymin, ymax', + ], +}; + +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const stXminDefinition: FunctionDefinition = { + type: 'eval', + name: 'st_xmin', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_xmin', { + defaultMessage: + 'Extracts the minimum value of the `x` coordinates from the supplied geometry.\nIf the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the minimum `longitude` value.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'point', + type: 'cartesian_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'cartesian_shape', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_shape', + optional: false, + }, + ], + returnType: 'double', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM airport_city_boundaries\n| WHERE abbrev == "CPH"\n| EVAL envelope = ST_ENVELOPE(city_boundary)\n| EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope)\n| KEEP abbrev, airport, xmin, xmax, ymin, ymax', + ], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const stYDefinition: FunctionDefinition = { type: 'eval', @@ -7721,6 +7898,126 @@ const stYDefinition: FunctionDefinition = { ], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const stYmaxDefinition: FunctionDefinition = { + type: 'eval', + name: 'st_ymax', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_ymax', { + defaultMessage: + 'Extracts the maximum value of the `y` coordinates from the supplied geometry.\nIf the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the maximum `latitude` value.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'point', + type: 'cartesian_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'cartesian_shape', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_shape', + optional: false, + }, + ], + returnType: 'double', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM airport_city_boundaries\n| WHERE abbrev == "CPH"\n| EVAL envelope = ST_ENVELOPE(city_boundary)\n| EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope)\n| KEEP abbrev, airport, xmin, xmax, ymin, ymax', + ], +}; + +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const stYminDefinition: FunctionDefinition = { + type: 'eval', + name: 'st_ymin', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_ymin', { + defaultMessage: + 'Extracts the minimum value of the `y` coordinates from the supplied geometry.\nIf the geometry is of type `geo_point` or `geo_shape` this is equivalent to extracting the minimum `latitude` value.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'point', + type: 'cartesian_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'cartesian_shape', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_point', + optional: false, + }, + ], + returnType: 'double', + }, + { + params: [ + { + name: 'point', + type: 'geo_shape', + optional: false, + }, + ], + returnType: 'double', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], + supportedOptions: ['by'], + validate: undefined, + examples: [ + 'FROM airport_city_boundaries\n| WHERE abbrev == "CPH"\n| EVAL envelope = ST_ENVELOPE(city_boundary)\n| EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope)\n| KEEP abbrev, airport, xmin, xmax, ymin, ymax', + ], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const startsWithDefinition: FunctionDefinition = { type: 'eval', @@ -7996,6 +8293,86 @@ const tauDefinition: FunctionDefinition = { examples: ['ROW TAU()'], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const termDefinition: FunctionDefinition = { + type: 'eval', + name: 'term', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.term', { + defaultMessage: + 'Performs a Term query on the specified field. Returns true if the provided term matches the row.', + }), + ignoreAsSuggestion: true, + + preview: true, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'field', + type: 'keyword', + optional: false, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'keyword', + optional: false, + }, + { + name: 'query', + type: 'text', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'text', + optional: false, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'text', + optional: false, + }, + { + 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 term(author, "gabriel") \n| keep book_no, title\n| limit 3;'], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const toBase64Definition: FunctionDefinition = { type: 'eval', @@ -9699,15 +10076,21 @@ export const scalarFunctionDefinitions = [ stContainsDefinition, stDisjointDefinition, stDistanceDefinition, + stEnvelopeDefinition, stIntersectsDefinition, stWithinDefinition, stXDefinition, + stXmaxDefinition, + stXminDefinition, stYDefinition, + stYmaxDefinition, + stYminDefinition, startsWithDefinition, substringDefinition, tanDefinition, tanhDefinition, tauDefinition, + termDefinition, toBase64Definition, toBooleanDefinition, toCartesianpointDefinition, 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 55eadf85a09f6..9dfc4a2a526a6 100644 --- a/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx +++ b/packages/kbn-language-documentation/src/sections/generated/scalar_functions.tsx @@ -337,6 +337,40 @@ export const functions = { ), }, // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.categorize', { + defaultMessage: 'CATEGORIZE', + }), + preview: true, + description: ( + + + ### CATEGORIZE + Groups text messages into categories of similarly formatted text values. + + \`\`\` + FROM sample_data + | STATS count=COUNT() BY category=CATEGORIZE(message) + \`\`\` + `, + 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', @@ -2523,6 +2557,42 @@ export const functions = { | EVAL distance = ST_DISTANCE(location, city_location) | KEEP abbrev, name, location, city_location, distance \`\`\` + `, + 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.st_envelope', { + defaultMessage: 'ST_ENVELOPE', + }), + preview: false, + description: ( + + + ### ST_ENVELOPE + Determines the minimum bounding box of the supplied geometry. + + \`\`\` + FROM airport_city_boundaries + | WHERE abbrev == "CPH" + | EVAL envelope = ST_ENVELOPE(city_boundary) + | KEEP abbrev, airport, envelope + \`\`\` `, description: 'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)', @@ -2639,6 +2709,82 @@ export const functions = { ), }, // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.st_xmax', { + defaultMessage: 'ST_XMAX', + }), + preview: false, + description: ( + + + ### ST_XMAX + Extracts the maximum value of the \`x\` coordinates from the supplied geometry. + If the geometry is of type \`geo_point\` or \`geo_shape\` this is equivalent to extracting the maximum \`longitude\` value. + + \`\`\` + FROM airport_city_boundaries + | WHERE abbrev == "CPH" + | EVAL envelope = ST_ENVELOPE(city_boundary) + | EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope) + | KEEP abbrev, airport, xmin, xmax, ymin, ymax + \`\`\` + `, + 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.st_xmin', { + defaultMessage: 'ST_XMIN', + }), + preview: false, + description: ( + + + ### ST_XMIN + Extracts the minimum value of the \`x\` coordinates from the supplied geometry. + If the geometry is of type \`geo_point\` or \`geo_shape\` this is equivalent to extracting the minimum \`longitude\` value. + + \`\`\` + FROM airport_city_boundaries + | WHERE abbrev == "CPH" + | EVAL envelope = ST_ENVELOPE(city_boundary) + | EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope) + | KEEP abbrev, airport, xmin, xmax, ymin, ymax + \`\`\` + `, + 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.st_y', { defaultMessage: 'ST_Y', @@ -2671,6 +2817,82 @@ export const functions = { ), }, // Do not edit manually... automatically generated by scripts/generate_esql_docs.ts + { + label: i18n.translate('languageDocumentation.documentationESQL.st_ymax', { + defaultMessage: 'ST_YMAX', + }), + preview: false, + description: ( + + + ### ST_YMAX + Extracts the maximum value of the \`y\` coordinates from the supplied geometry. + If the geometry is of type \`geo_point\` or \`geo_shape\` this is equivalent to extracting the maximum \`latitude\` value. + + \`\`\` + FROM airport_city_boundaries + | WHERE abbrev == "CPH" + | EVAL envelope = ST_ENVELOPE(city_boundary) + | EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope) + | KEEP abbrev, airport, xmin, xmax, ymin, ymax + \`\`\` + `, + 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.st_ymin', { + defaultMessage: 'ST_YMIN', + }), + preview: false, + description: ( + + + ### ST_YMIN + Extracts the minimum value of the \`y\` coordinates from the supplied geometry. + If the geometry is of type \`geo_point\` or \`geo_shape\` this is equivalent to extracting the minimum \`latitude\` value. + + \`\`\` + FROM airport_city_boundaries + | WHERE abbrev == "CPH" + | EVAL envelope = ST_ENVELOPE(city_boundary) + | EVAL xmin = ST_XMIN(envelope), xmax = ST_XMAX(envelope), ymin = ST_YMIN(envelope), ymax = ST_YMAX(envelope) + | KEEP abbrev, airport, xmin, xmax, ymin, ymax + \`\`\` + `, + 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.starts_with', { defaultMessage: 'STARTS_WITH',