diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts index 4bfdbb6a16395..22af81a95bc5c 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/aggregation_functions.ts @@ -1341,6 +1341,64 @@ const stCentroidAggDefinition: FunctionDefinition = { examples: ['FROM airports\n| STATS centroid=ST_CENTROID_AGG(location)'], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const stExtentAggDefinition: FunctionDefinition = { + type: 'agg', + name: 'st_extent_agg', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.st_extent_agg', { + defaultMessage: + 'Calculate the spatial extent over a field with geometry type. Returns a bounding box for all values of the field.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'field', + type: 'cartesian_point', + optional: false, + }, + ], + returnType: 'cartesian_shape', + }, + { + params: [ + { + name: 'field', + type: 'cartesian_shape', + optional: false, + }, + ], + returnType: 'cartesian_shape', + }, + { + params: [ + { + name: 'field', + type: 'geo_point', + optional: false, + }, + ], + returnType: 'geo_shape', + }, + { + params: [ + { + name: 'field', + type: 'geo_shape', + optional: false, + }, + ], + returnType: 'geo_shape', + }, + ], + supportedCommands: ['stats', 'inlinestats', 'metrics'], + supportedOptions: undefined, + validate: undefined, + examples: ['FROM airports\n| WHERE country == "India"\n| STATS extent = ST_EXTENT_AGG(location)'], +}; + // Do not edit this manually... generated by scripts/generate_function_definitions.ts const stdDevDefinition: FunctionDefinition = { type: 'agg', @@ -1921,6 +1979,7 @@ export const aggregationFunctionDefinitions = [ minDefinition, percentileDefinition, stCentroidAggDefinition, + stExtentAggDefinition, stdDevDefinition, sumDefinition, topDefinition, 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 20e3fe964722b..4837dfbc0413c 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 @@ -2177,6 +2177,84 @@ const greatestDefinition: FunctionDefinition = { examples: ['ROW a = 10, b = 20\n| EVAL g = GREATEST(a, b)'], }; +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const hashDefinition: FunctionDefinition = { + type: 'eval', + name: 'hash', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.hash', { + defaultMessage: + 'Computes the hash of the input using various algorithms such as MD5, SHA, SHA-224, SHA-256, SHA-384, SHA-512.', + }), + preview: false, + alias: undefined, + signatures: [ + { + params: [ + { + name: 'algorithm', + type: 'keyword', + optional: false, + }, + { + name: 'input', + type: 'keyword', + optional: false, + }, + ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'algorithm', + type: 'keyword', + optional: false, + }, + { + name: 'input', + type: 'text', + optional: false, + }, + ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'algorithm', + type: 'text', + optional: false, + }, + { + name: 'input', + type: 'keyword', + optional: false, + }, + ], + returnType: 'keyword', + }, + { + params: [ + { + name: 'algorithm', + type: 'text', + optional: false, + }, + { + name: 'input', + type: 'text', + optional: false, + }, + ], + returnType: 'keyword', + }, + ], + 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 hypotDefinition: FunctionDefinition = { type: 'eval', @@ -3446,7 +3524,7 @@ const matchDefinition: FunctionDefinition = { name: 'match', description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.match', { defaultMessage: - 'Performs a match query on the specified field. Returns true if the provided query matches the row.', + 'Use `MATCH` to perform a match query on the specified field.\nUsing `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL.\n\nMatch can be used on text fields, as well as other field types like boolean, dates, and numeric types.\n\nFor a simplified syntax, you can use the match operator `:` operator instead of `MATCH`.\n\n`MATCH` returns true if the provided query matches the row.', }), preview: true, alias: undefined, @@ -3455,8 +3533,88 @@ const matchDefinition: FunctionDefinition = { params: [ { name: 'field', + type: 'boolean', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'boolean', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'boolean', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'date', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'date', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'date', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', type: 'keyword', optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'date_nanos', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'date_nanos', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'date_nanos', + optional: false, fieldsOnly: true, }, { @@ -3471,13 +3629,61 @@ const matchDefinition: FunctionDefinition = { params: [ { name: 'field', + type: 'double', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'double', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'double', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'integer', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'double', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', type: 'keyword', optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'double', + optional: false, fieldsOnly: true, }, { name: 'query', - type: 'text', + type: 'long', optional: false, }, ], @@ -3487,7 +3693,39 @@ const matchDefinition: FunctionDefinition = { params: [ { name: 'field', - type: 'text', + type: 'integer', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'double', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'integer', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'integer', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'integer', optional: false, fieldsOnly: true, }, @@ -3503,14 +3741,254 @@ const matchDefinition: FunctionDefinition = { params: [ { name: 'field', - type: 'text', + type: 'integer', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'long', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'ip', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'ip', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'ip', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'keyword', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'double', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'long', optional: false, fieldsOnly: true, }, { name: 'query', + type: 'integer', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'long', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', type: 'text', optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'unsigned_long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'double', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'unsigned_long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'integer', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'unsigned_long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'unsigned_long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'long', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'unsigned_long', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'unsigned_long', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'version', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'keyword', + optional: false, + }, + ], + returnType: 'boolean', + }, + { + params: [ + { + name: 'field', + type: 'version', + optional: false, + fieldsOnly: true, + }, + { + name: 'query', + type: 'version', + optional: false, }, ], returnType: 'boolean', @@ -8370,7 +8848,7 @@ const termDefinition: FunctionDefinition = { 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;'], + 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 @@ -10029,6 +10507,7 @@ export const scalarFunctionDefinitions = [ floorDefinition, fromBase64Definition, greatestDefinition, + hashDefinition, hypotDefinition, ipPrefixDefinition, kqlDefinition, diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/validation.functions.full_text.test.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/validation.functions.full_text.test.ts index b7d962ffb4a42..e8d378d7c8935 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/validation.functions.full_text.test.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/validation.functions.full_text.test.ts @@ -31,17 +31,6 @@ describe('validation', () => { '[MATCH] function is only supported in WHERE commands', ]); }); - - it('shows errors if argument is not an index field ', async () => { - const { expectErrors } = await setup(); - await expectErrors( - 'FROM index | LIMIT 10 | where MATCH(`kubernetes.something.something`, "value")', - [ - 'Argument of [match] must be [keyword], found value [kubernetes.something.something] type [double]', - '[MATCH] function cannot be used after LIMIT', - ] - ); - }); }); describe('QSRT function', () => { it('no error if valid', async () => {