diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts index 6317f18a30eea..22ea2bb424d08 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/scripts/generate_function_definitions.ts @@ -18,6 +18,7 @@ import { FunctionReturnType, Signature, FunctionDefinitionTypes, + Location, } from '../src/definitions/types'; import { FULL_TEXT_SEARCH_FUNCTIONS } from '../src/shared/constants'; const aliasTable: Record = { @@ -79,14 +80,17 @@ const bucketParameterTypes: Array< ['long', 'integer', 'long', 'long', 'double'], ]; -const scalarSupportedCommandsAndOptions = { - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], -}; +const defaultScalarFunctionLocations: Location[] = [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, +]; -const aggregationSupportedCommandsAndOptions = { - supportedCommands: ['stats', 'inlinestats', 'metrics'], -}; +const defaultAggFunctionLocations: Location[] = [Location.STATS]; // coalesce can be removed when a test is added for version type // (https://github.com/elastic/elasticsearch/pull/109032#issuecomment-2150033350) @@ -98,7 +102,7 @@ const extraFunctions: FunctionDefinition[] = [ name: 'case', description: 'Accepts pairs of conditions and values. The function returns the value that belongs to the first condition that evaluates to `true`. If the number of arguments is odd, the last argument is the default value which is returned when no condition matches.', - ...scalarSupportedCommandsAndOptions, + locationsAvailable: defaultScalarFunctionLocations, signatures: [ { params: [ @@ -306,26 +310,20 @@ const convertDateTime = (s: string) => (s === 'datetime' ? 'date' : s); * @returns */ function getFunctionDefinition(ESFunctionDefinition: Record): FunctionDefinition { - let supportedCommandsAndOptions: Pick< - FunctionDefinition, - 'supportedCommands' | 'supportedOptions' - > = + let locationsAvailable = ESFunctionDefinition.type === FunctionDefinitionTypes.SCALAR - ? scalarSupportedCommandsAndOptions - : aggregationSupportedCommandsAndOptions; + ? defaultScalarFunctionLocations + : defaultAggFunctionLocations; // MATCH and QSRT has limited supported for where commands only if (FULL_TEXT_SEARCH_FUNCTIONS.includes(ESFunctionDefinition.name)) { - supportedCommandsAndOptions = { - supportedCommands: ['where'], - supportedOptions: [], - }; + locationsAvailable = [Location.WHERE]; } const ret = { type: ESFunctionDefinition.type, name: ESFunctionDefinition.name, operator: ESFunctionDefinition.operator, - ...supportedCommandsAndOptions, + locationsAvailable, description: ESFunctionDefinition.description, alias: aliasTable[ESFunctionDefinition.name], ignoreAsSuggestion: ESFunctionDefinition.snapshot_only, @@ -690,13 +688,13 @@ const enrichGrouping = ( ]; return { ...op, + locationsAvailable: [...op.locationsAvailable, Location.STATS_BY], signatures, - supportedOptions: ['by'], }; } return { ...op, - supportedOptions: ['by'], + locationsAvailable: [...op.locationsAvailable, Location.STATS_BY], }; }); }; @@ -721,26 +719,32 @@ const enrichOperators = ( // Elasticsearch docs uses lhs and rhs instead of left and right that Kibana code uses params: s.params.map((param) => ({ ...param, name: replaceParamName(param.name) })), })); - let supportedCommands = op.supportedCommands; - let supportedOptions = op.supportedOptions; + + let locationsAvailable = op.locationsAvailable; + if (isComparisonOperator) { - supportedCommands = _.uniq([...op.supportedCommands, 'eval', 'where', 'row', 'sort']); - supportedOptions = ['by']; + locationsAvailable = _.uniq([ + ...op.locationsAvailable, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ]); } if (isMathOperator) { - supportedCommands = _.uniq([ - ...op.supportedCommands, - 'eval', - 'where', - 'row', - 'stats', - 'metrics', - 'sort', + locationsAvailable = _.uniq([ + ...op.locationsAvailable, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.STATS, + Location.SORT, + Location.STATS_BY, ]); - supportedOptions = ['by']; } if (isInOperator || isLikeOperator || isNotOperator) { - supportedCommands = ['eval', 'where', 'row', 'sort']; + locationsAvailable = [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW]; } if (isInOperator) { // Override the signatures to be array types instead of singular @@ -766,8 +770,7 @@ const enrichOperators = ( signatures, // Elasticsearch docs does not include the full supported commands for math operators // so we are overriding to add proper support - supportedCommands, - supportedOptions, + locationsAvailable, type: FunctionDefinitionTypes.OPERATOR, validate: validators[op.name], ...(isNotOperator ? { ignoreAsSuggestion: true } : {}), @@ -829,6 +832,12 @@ function printGeneratedFunctionsFile( if (name.toLowerCase() === 'match') { functionName = 'match'; } + + // Map locationsAvailable to enum names + const locationsAvailable = functionDefinition.locationsAvailable.map( + (location) => `Location.${location.toUpperCase()}` + ); + return `// Do not edit this manually... generated by scripts/generate_function_definitions.ts const ${getDefinitionName(name)}: FunctionDefinition = { type: FunctionDefinitionTypes.${type.toUpperCase()}, @@ -839,8 +848,7 @@ function printGeneratedFunctionsFile( preview: ${functionDefinition.preview || 'false'}, alias: ${alias ? `['${alias.join("', '")}']` : 'undefined'}, signatures: ${JSON.stringify(signatures, null, 2)}, - supportedCommands: ${JSON.stringify(functionDefinition.supportedCommands)}, - supportedOptions: ${JSON.stringify(functionDefinition.supportedOptions)}, + locationsAvailable: [${locationsAvailable.join(', ')}], validate: ${functionDefinition.validate || 'undefined'}, examples: ${JSON.stringify(functionDefinition.examples || [])},${ customParametersSnippet @@ -870,7 +878,7 @@ function printGeneratedFunctionsFile( */ import { i18n } from '@kbn/i18n'; -import { type FunctionDefinition, FunctionDefinitionTypes } from '../types'; +import { type FunctionDefinition, FunctionDefinitionTypes, Location } from '../types'; ${ functionsType === FunctionDefinitionTypes.SCALAR ? `import type { ESQLFunction } from '@kbn/esql-ast'; diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/helpers.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/helpers.ts index 7aab04196ec5d..4a6f9b3e722c6 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/helpers.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/helpers.ts @@ -14,7 +14,10 @@ import { operatorsDefinitions } from '../../definitions/all_operators'; import { NOT_SUGGESTED_TYPES } from '../../shared/resources_helpers'; import { aggFunctionDefinitions } from '../../definitions/generated/aggregation_functions'; import { timeUnitsToSuggest } from '../../definitions/literals'; -import { FunctionDefinitionTypes } from '../../definitions/types'; +import { + FunctionDefinitionTypes, + getLocationFromCommandOrOptionName, +} from '../../definitions/types'; import { groupingFunctionDefinitions } from '../../definitions/generated/grouping_functions'; import * as autocomplete from '../autocomplete'; import type { ESQLCallbacks } from '../../shared/types'; @@ -175,14 +178,16 @@ export function getFunctionSignaturesByReturnType( const deduped = Array.from(new Set(list)); const commands = Array.isArray(command) ? command : [command]; + return deduped - .filter(({ signatures, ignoreAsSuggestion, supportedCommands, supportedOptions, name }) => { + .filter(({ signatures, ignoreAsSuggestion, locationsAvailable }) => { if (ignoreAsSuggestion) { return false; } if ( - !commands.some((c) => supportedCommands.includes(c)) && - !supportedOptions?.includes(option || '') + !(option ? [...commands, option] : commands).some((name) => + locationsAvailable.includes(getLocationFromCommandOrOptionName(name)) + ) ) { return false; } diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/hidden_functions_and_commands.test.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/hidden_functions_and_commands.test.ts index 469c6dd82a175..05de069261ade 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/hidden_functions_and_commands.test.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/hidden_functions_and_commands.test.ts @@ -8,7 +8,7 @@ */ import { setTestFunctions } from '../../shared/test_functions'; -import { FunctionDefinitionTypes } from '../../definitions/types'; +import { FunctionDefinitionTypes, Location } from '../../definitions/types'; import { setup } from './helpers'; describe('hidden commands', () => { @@ -33,7 +33,7 @@ describe('hidden functions', () => { name: 'HIDDEN_FUNCTION', description: 'This is a hidden function', signatures: [{ params: [], returnType: 'text' }], - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], ignoreAsSuggestion: true, }, { @@ -41,7 +41,7 @@ describe('hidden functions', () => { name: 'VISIBLE_FUNCTION', description: 'This is a visible function', signatures: [{ params: [], returnType: 'text' }], - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], ignoreAsSuggestion: false, }, ]); @@ -59,7 +59,7 @@ describe('hidden functions', () => { name: 'HIDDEN_FUNCTION', description: 'This is a hidden function', signatures: [{ params: [], returnType: 'text' }], - supportedCommands: ['stats'], + locationsAvailable: [Location.STATS], ignoreAsSuggestion: true, }, { @@ -67,7 +67,7 @@ describe('hidden functions', () => { name: 'VISIBLE_FUNCTION', description: 'This is a visible function', signatures: [{ params: [], returnType: 'text' }], - supportedCommands: ['stats'], + locationsAvailable: [Location.STATS], ignoreAsSuggestion: false, }, ]); @@ -84,9 +84,14 @@ describe('hidden functions', () => { type: FunctionDefinitionTypes.OPERATOR, name: 'HIDDEN_OPERATOR', description: 'This is a hidden function', - supportedCommands: ['eval', 'where', 'row', 'sort'], + locationsAvailable: [ + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], ignoreAsSuggestion: true, - supportedOptions: ['by'], signatures: [ { params: [ @@ -101,9 +106,14 @@ describe('hidden functions', () => { type: FunctionDefinitionTypes.OPERATOR, name: 'VISIBLE_OPERATOR', description: 'This is a visible function', - supportedCommands: ['eval', 'where', 'row', 'sort'], + locationsAvailable: [ + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], ignoreAsSuggestion: false, - supportedOptions: ['by'], signatures: [ { params: [ diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts index 8eabaf00967a6..37a6f77d13038 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.ts @@ -74,6 +74,7 @@ import { FunctionParameter, FunctionDefinitionTypes, GetPolicyMetadataFn, + getLocationFromCommandOrOptionName, } from '../definitions/types'; import { comparisonFunctions } from '../definitions/all_operators'; import { getRecommendedQueriesSuggestions } from './recommended_queries/suggestions'; @@ -268,8 +269,7 @@ async function getSuggestionsWithinCommandExpression( ) { return await getSuggestionsToRightOfOperatorExpression({ queryText: innerText, - commandName: astContext.command.name, - optionName: astContext.option?.name, + location: getLocationFromCommandOrOptionName(astContext.command.name), rootOperator: astContext.node, getExpressionType: (expression) => getExpressionType(expression, references.fields, references.variables), @@ -491,8 +491,7 @@ async function getFunctionArgsSuggestions( if (typesToSuggestNext.every((d) => !d.fieldsOnly)) { suggestions.push( ...getFunctionSuggestions({ - command: command.name, - option: option?.name, + location: getLocationFromCommandOrOptionName(option?.name ?? command.name), returnTypes: canBeBooleanCondition ? ['any'] : (getTypesFromParamDefs(typesToSuggestNext) as string[]), @@ -596,8 +595,7 @@ async function getListArgsSuggestions( suggestions.push( ...(await getFieldsOrFunctionsSuggestions( [argType as string], - command.name, - undefined, + getLocationFromCommandOrOptionName(command.name), getFieldsByType, { functions: true, diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/enrich/index.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/enrich/index.ts index 7e288304a1694..689062468b572 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/enrich/index.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/enrich/index.ts @@ -14,7 +14,7 @@ import { isSingleItem, unescapeColumnName, } from '../../../shared/helpers'; -import { CommandSuggestParams } from '../../../definitions/types'; +import { CommandSuggestParams, Location } from '../../../definitions/types'; import type { SuggestionRawDefinition } from '../../types'; import { Position, @@ -145,7 +145,7 @@ export async function suggest({ return [pipeCompleteItem, { ...commaCompleteItem, command: TRIGGER_SUGGESTION_COMMAND }]; } else { // not recognized as a field name, assume new user-defined column name - return getOperatorSuggestions({ command: 'enrich' }); + return getOperatorSuggestions({ location: Location.ENRICH }); } } diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/eval/index.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/eval/index.ts index a7cb76c199527..a0c111e5579cb 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/eval/index.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/eval/index.ts @@ -10,7 +10,7 @@ import type { ESQLSingleAstItem } from '@kbn/esql-ast'; import { isMarkerNode } from '../../../shared/context'; import { isAssignment, isColumnItem } from '../../../..'; -import { CommandSuggestParams } from '../../../definitions/types'; +import { CommandSuggestParams, Location } from '../../../definitions/types'; import type { SuggestionRawDefinition } from '../../types'; import { getNewVariableSuggestion } from '../../factories'; import { commaCompleteItem, pipeCompleteItem } from '../../complete_items'; @@ -40,7 +40,7 @@ export async function suggest( const suggestions = await suggestForExpression({ ...params, expressionRoot, - commandName: 'eval', + location: Location.EVAL, }); const positionInExpression = getExpressionPosition(params.innerText, expressionRoot); diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/row/index.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/row/index.ts index 1e8067d5614c2..12a1c6dab6f63 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/row/index.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/row/index.ts @@ -8,7 +8,7 @@ */ import { isRestartingExpression } from '../../../shared/helpers'; -import { CommandSuggestParams } from '../../../definitions/types'; +import { CommandSuggestParams, Location } from '../../../definitions/types'; import type { SuggestionRawDefinition } from '../../types'; import { @@ -25,7 +25,7 @@ export async function suggest({ }: CommandSuggestParams<'row'>): Promise { // ROW var0 = / if (/=\s*$/.test(innerText)) { - return getFunctionSuggestions({ command: 'row' }); + return getFunctionSuggestions({ location: Location.ROW }); } // ROW var0 = 23 / @@ -40,6 +40,6 @@ export async function suggest({ // ROW foo = "bar", / return [ getNewVariableSuggestion(getSuggestedVariableName()), - ...getFunctionSuggestions({ command: 'row' }), + ...getFunctionSuggestions({ location: Location.ROW }), ]; } diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/sort/index.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/sort/index.ts index acd107dc674f4..9057b8d1c85c7 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/sort/index.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/sort/index.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { CommandSuggestParams } from '../../../definitions/types'; +import { CommandSuggestParams, Location } from '../../../definitions/types'; import { noCaseCompare } from '../../../shared/helpers'; import { commaCompleteItem, pipeCompleteItem } from '../../complete_items'; import { TRIGGER_SUGGESTION_COMMAND } from '../../factories'; @@ -111,8 +111,7 @@ export async function suggest({ }); const functionSuggestions = await getFieldsOrFunctionsSuggestions( ['any'], - 'sort', - undefined, + Location.SORT, getColumnsByType, { functions: true, diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/stats/index.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/stats/index.ts index 6ce3522526b57..d9e7fbebc99be 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/stats/index.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/stats/index.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ import { ESQLVariableType } from '@kbn/esql-types'; -import { CommandSuggestParams } from '../../../definitions/types'; +import { CommandSuggestParams, Location } from '../../../definitions/types'; import type { SuggestionRawDefinition } from '../../types'; import { TRIGGER_SUGGESTION_COMMAND, @@ -44,12 +44,12 @@ export async function suggest({ case 'expression_without_assignment': return [ ...controlSuggestions, - ...getFunctionSuggestions({ command: 'stats' }), + ...getFunctionSuggestions({ location: Location.STATS }), getNewVariableSuggestion(getSuggestedVariableName()), ]; case 'expression_after_assignment': - return [...controlSuggestions, ...getFunctionSuggestions({ command: 'stats' })]; + return [...controlSuggestions, ...getFunctionSuggestions({ location: Location.STATS })]; case 'expression_complete': return [ @@ -60,14 +60,14 @@ export async function suggest({ case 'grouping_expression_after_assignment': return [ - ...getFunctionSuggestions({ command: 'stats', option: 'by' }), + ...getFunctionSuggestions({ location: Location.STATS_BY }), getDateHistogramCompletionItem((await getPreferences?.())?.histogramBarTarget), ...columnSuggestions, ]; case 'grouping_expression_without_assignment': return [ - ...getFunctionSuggestions({ command: 'stats', option: 'by' }), + ...getFunctionSuggestions({ location: Location.STATS_BY }), getDateHistogramCompletionItem((await getPreferences?.())?.histogramBarTarget), ...columnSuggestions, getNewVariableSuggestion(getSuggestedVariableName()), diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/where/index.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/where/index.ts index 8bd6233d76017..1b2f51af5ff5c 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/where/index.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/commands/where/index.ts @@ -8,7 +8,7 @@ */ import { type ESQLSingleAstItem } from '@kbn/esql-ast'; -import { CommandSuggestParams } from '../../../definitions/types'; +import { CommandSuggestParams, Location } from '../../../definitions/types'; import type { SuggestionRawDefinition } from '../../types'; import { pipeCompleteItem } from '../../complete_items'; import { buildPartialMatcher, suggestForExpression } from '../../helper'; @@ -23,7 +23,8 @@ export async function suggest( const suggestions = await suggestForExpression({ ...params, expressionRoot, - commandName: 'where', + location: Location.WHERE, + preferredExpressionType: 'boolean', }); const isExpressionComplete = diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts index 7a9d4d1548465..836a33a755b67 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/factories.ts @@ -20,6 +20,7 @@ import { FunctionDefinition, FunctionParameterType, FunctionDefinitionTypes, + Location, } from '../definitions/types'; import { shouldBeQuotedSource, shouldBeQuotedText } from '../shared/helpers'; import { buildFunctionDocumentation } from './documentation_util'; @@ -113,8 +114,7 @@ export function getOperatorSuggestion(fn: FunctionDefinition): SuggestionRawDefi } interface FunctionFilterPredicates { - command?: string; - option?: string | undefined; + location: Location; returnTypes?: string[]; ignored?: string[]; } @@ -126,32 +126,27 @@ export const filterFunctionDefinitions = ( if (!predicates) { return functions; } - const { command, option, returnTypes, ignored = [] } = predicates; - return functions.filter( - ({ name, supportedCommands, supportedOptions, ignoreAsSuggestion, signatures }) => { - if (ignoreAsSuggestion) { - return false; - } - - if (ignored.includes(name)) { - return false; - } + const { location, returnTypes, ignored = [] } = predicates; - if (option && !supportedOptions?.includes(option)) { - return false; - } + return functions.filter(({ name, locationsAvailable, ignoreAsSuggestion, signatures }) => { + if (ignoreAsSuggestion) { + return false; + } - if (command && !supportedCommands.includes(command)) { - return false; - } + if (ignored.includes(name)) { + return false; + } - if (returnTypes && !returnTypes.includes('any')) { - return signatures.some((signature) => returnTypes.includes(signature.returnType as string)); - } + if (location && !locationsAvailable.includes(location)) { + return false; + } - return true; + if (returnTypes && !returnTypes.includes('any')) { + return signatures.some((signature) => returnTypes.includes(signature.returnType as string)); } - ); + + return true; + }); }; /** diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/helper.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/helper.ts index 9d98949d2eddc..d8c311bb8574e 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/helper.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/autocomplete/helper.ts @@ -27,6 +27,7 @@ import { isReturnType, FunctionDefinitionTypes, CommandSuggestParams, + Location, } from '../definitions/types'; import { findFinalWord, @@ -380,8 +381,7 @@ export function handleFragment( */ export async function getFieldsOrFunctionsSuggestions( types: string[], - commandName: string, - optionName: string | undefined, + location: Location, getFieldsByType: GetColumnsByTypeFn, { functions, @@ -407,8 +407,8 @@ export async function getFieldsOrFunctionsSuggestions( const filteredFieldsByType = pushItUpInTheList( (await (fields ? getFieldsByType(types, ignoreColumns, { - advanceCursor: commandName === 'sort', - openSuggestions: commandName === 'sort', + advanceCursor: location === Location.SORT, + openSuggestions: location === Location.SORT, variableType: values ? ESQLVariableType.VALUES : ESQLVariableType.FIELDS, }) : [])) as SuggestionRawDefinition[], @@ -444,14 +444,14 @@ export async function getFieldsOrFunctionsSuggestions( } } // could also be in stats (bucket) but our autocomplete is not great yet - const displayDateSuggestions = types.includes('date') && ['where', 'eval'].includes(commandName); + const displayDateSuggestions = + types.includes('date') && [Location.WHERE, Location.EVAL].includes(location); const suggestions = filteredFieldsByType.concat( displayDateSuggestions ? getDateLiterals() : [], functions ? getFunctionSuggestions({ - command: commandName, - option: optionName, + location, returnTypes: types, ignored: ignoreFn, }) @@ -564,16 +564,14 @@ export function checkFunctionInvocationComplete( */ export async function getSuggestionsToRightOfOperatorExpression({ queryText, - commandName, - optionName, + location, rootOperator: operator, preferredExpressionType, getExpressionType, getColumnsByType, }: { queryText: string; - commandName: string; - optionName?: string; + location: Location; rootOperator: ESQLFunction; preferredExpressionType?: SupportedDataType; getExpressionType: (expression: ESQLAstItem) => SupportedDataType | 'unknown'; @@ -587,8 +585,7 @@ export async function getSuggestionsToRightOfOperatorExpression({ const operatorReturnType = getExpressionType(operator); suggestions.push( ...getOperatorSuggestions({ - command: commandName, - option: optionName, + location, // here we use the operator return type because we're suggesting operators that could // accept the result of the existing operator as a left operand leftParamType: @@ -634,17 +631,11 @@ export async function getSuggestionsToRightOfOperatorExpression({ // TODO replace with fields callback + function suggestions suggestions.push( - ...(await getFieldsOrFunctionsSuggestions( - typeToUse, - commandName, - optionName, - getColumnsByType, - { - functions: true, - fields: true, - values: Boolean(operator.subtype === 'binary-expression'), - } - )) + ...(await getFieldsOrFunctionsSuggestions(typeToUse, location, getColumnsByType, { + functions: true, + fields: true, + values: Boolean(operator.subtype === 'binary-expression'), + })) ); } } @@ -671,7 +662,7 @@ export async function getSuggestionsToRightOfOperatorExpression({ ) { suggestions.push( ...getOperatorSuggestions({ - command: commandName, + location, leftParamType: leftArgType, returnTypes: [preferredExpressionType], }) @@ -763,10 +754,12 @@ export async function suggestForExpression({ getExpressionType, getColumnsByType, previousCommands, - commandName, + location, + preferredExpressionType, }: { expressionRoot: ESQLSingleAstItem | undefined; - commandName: string; + location: Location; + preferredExpressionType?: SupportedDataType; } & Pick< CommandSuggestParams, 'innerText' | 'getExpressionType' | 'getColumnsByType' | 'previousCommands' @@ -789,7 +782,7 @@ export async function suggestForExpression({ suggestions.push( ...getOperatorSuggestions({ - command: commandName, + location, leftParamType: expressionType, ignored: ['='], }) @@ -811,7 +804,7 @@ export async function suggestForExpression({ case 'after_not': if (expressionRoot && isFunctionItem(expressionRoot) && expressionRoot.name === 'not') { suggestions.push( - ...getFunctionSuggestions({ command: commandName, returnTypes: ['boolean'] }), + ...getFunctionSuggestions({ location, returnTypes: ['boolean'] }), ...(await getColumnsByType('boolean', [], { advanceCursor: true, openSuggestions: true })) ); } else { @@ -853,9 +846,9 @@ export async function suggestForExpression({ suggestions.push( ...(await getSuggestionsToRightOfOperatorExpression({ queryText: innerText, - commandName, + location, rootOperator: rightmostOperator, - preferredExpressionType: commandName === 'where' ? 'boolean' : undefined, + preferredExpressionType, getExpressionType, getColumnsByType, })) @@ -883,7 +876,7 @@ export async function suggestForExpression({ } suggestions.push( ...pushItUpInTheList(columnSuggestions, true), - ...getFunctionSuggestions({ command: commandName, ignored }) + ...getFunctionSuggestions({ location, ignored }) ); break; diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/all_operators.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/all_operators.ts index c5f5fc1302123..8f9d56a534630 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/all_operators.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/all_operators.ts @@ -13,6 +13,7 @@ import { type FunctionParameterType, type FunctionReturnType, FunctionDefinitionTypes, + Location, } from './types'; import { operatorFunctionDefinitions } from './generated/operators'; type MathFunctionSignature = [FunctionParameterType, FunctionParameterType, FunctionReturnType]; @@ -65,8 +66,13 @@ function createComparisonDefinition( type: FunctionDefinitionTypes.OPERATOR, name, description, - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate, signatures: [ ...commonSignatures, @@ -212,8 +218,13 @@ export const logicalOperators: FunctionDefinition[] = [ type: FunctionDefinitionTypes.OPERATOR, name, description, - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], signatures: [ { params: [ @@ -242,7 +253,7 @@ const nullFunctions: FunctionDefinition[] = [ type: FunctionDefinitionTypes.OPERATOR, name, description, - supportedCommands: ['eval', 'where', 'row', 'sort'], + locationsAvailable: [Location.EVAL, Location.WHERE, Location.ROW, Location.SORT], signatures: [ { params: [{ name: 'left', type: 'any' }], @@ -258,8 +269,13 @@ const otherDefinitions: FunctionDefinition[] = [ description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.notDoc', { defaultMessage: 'Not', }), - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], signatures: [ { params: [{ name: 'expression', type: 'boolean' }], @@ -273,17 +289,16 @@ const otherDefinitions: FunctionDefinition[] = [ description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.assignDoc', { defaultMessage: 'Assign (=)', }), - supportedCommands: [ - 'eval', - 'stats', - 'inlinestats', - 'metrics', - 'row', - 'dissect', - 'where', - 'enrich', + locationsAvailable: [ + Location.EVAL, + Location.STATS, + Location.STATS_BY, + Location.ROW, + Location.WHERE, + Location.ENRICH, + Location.ENRICH_WITH, + Location.DISSECT, ], - supportedOptions: ['by', 'with'], signatures: [ { params: [ @@ -300,8 +315,7 @@ const otherDefinitions: FunctionDefinition[] = [ description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.asDoc', { defaultMessage: 'Rename as (AS)', }), - supportedCommands: ['rename', 'join'], - supportedOptions: [], + locationsAvailable: [Location.RENAME, Location.JOIN], signatures: [ { params: [ @@ -318,8 +332,7 @@ const otherDefinitions: FunctionDefinition[] = [ description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.whereDoc', { defaultMessage: 'WHERE operator', }), - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: [], + locationsAvailable: [Location.STATS], signatures: [ { params: [ @@ -337,7 +350,7 @@ const otherDefinitions: FunctionDefinition[] = [ description: i18n.translate('kbn-esql-validation-autocomplete.esql.definition.infoDoc', { defaultMessage: 'Show information about the current ES node', }), - supportedCommands: ['show'], + locationsAvailable: [Location.SHOW], signatures: [ { params: [], 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 73b31d9290196..e6d5578302908 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 @@ -27,7 +27,7 @@ */ import { i18n } from '@kbn/i18n'; -import { type FunctionDefinition, FunctionDefinitionTypes } from '../types'; +import { type FunctionDefinition, FunctionDefinitionTypes, Location } from '../types'; // Do not edit this manually... generated by scripts/generate_function_definitions.ts const avgDefinition: FunctionDefinition = { @@ -70,8 +70,7 @@ const avgDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS AVG(height)', @@ -211,8 +210,7 @@ const countDefinition: FunctionDefinition = { returnType: 'long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS COUNT(height)', @@ -784,8 +782,7 @@ const countDistinctDefinition: FunctionDefinition = { returnType: 'long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM hosts\n| STATS COUNT_DISTINCT(ip0), COUNT_DISTINCT(ip1)', @@ -905,8 +902,7 @@ const maxDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS MAX(languages)', @@ -956,8 +952,7 @@ const medianDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS MEDIAN(salary), PERCENTILE(salary, 50)', @@ -1010,8 +1005,7 @@ const medianAbsoluteDeviationDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS MEDIAN(salary), MEDIAN_ABSOLUTE_DEVIATION(salary)', @@ -1130,8 +1124,7 @@ const minDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS MIN(languages)', @@ -1295,8 +1288,7 @@ const percentileDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS p0 = PERCENTILE(salary, 0)\n , p50 = PERCENTILE(salary, 50)\n , p99 = PERCENTILE(salary, 99)', @@ -1335,8 +1327,7 @@ const stCentroidAggDefinition: FunctionDefinition = { returnType: 'geo_point', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: ['FROM airports\n| STATS centroid=ST_CENTROID_AGG(location)'], }; @@ -1393,8 +1384,7 @@ const stExtentAggDefinition: FunctionDefinition = { returnType: 'geo_shape', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: ['FROM airports\n| WHERE country == "India"\n| STATS extent = ST_EXTENT_AGG(location)'], }; @@ -1440,8 +1430,7 @@ const stdDevDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS STD_DEV(height)', @@ -1490,8 +1479,7 @@ const sumDefinition: FunctionDefinition = { returnType: 'long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS SUM(languages)', @@ -1688,8 +1676,7 @@ const topDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS top_salaries = TOP(salary, 3, "desc"), top_salary = MAX(salary)', @@ -1848,8 +1835,7 @@ const valuesDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ ' FROM employees\n| EVAL first_letter = SUBSTRING(first_name, 0, 1)\n| STATS first_name=MV_SORT(VALUES(first_name)) BY first_letter\n| SORT first_letter', @@ -2002,8 +1988,7 @@ const weightedAvgDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [ 'FROM employees\n| STATS w_avg = WEIGHTED_AVG(salary, height) by languages\n| EVAL w_avg = ROUND(w_avg)\n| KEEP w_avg, languages\n| SORT languages', diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/grouping_functions.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/grouping_functions.ts index ef57bb1dcdd46..5adf5db48a8d7 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/grouping_functions.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/grouping_functions.ts @@ -27,7 +27,7 @@ */ import { i18n } from '@kbn/i18n'; -import { type FunctionDefinition, FunctionDefinitionTypes } from '../types'; +import { type FunctionDefinition, FunctionDefinitionTypes, Location } from '../types'; // Do not edit this manually... generated by scripts/generate_function_definitions.ts const bucketDefinition: FunctionDefinition = { @@ -821,8 +821,7 @@ const bucketDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: ['by'], + locationsAvailable: [Location.STATS, Location.STATS_BY], validate: undefined, examples: [ 'FROM employees\n| WHERE hire_date >= "1985-01-01T00:00:00Z" AND hire_date < "1986-01-01T00:00:00Z"\n| STATS hire_date = MV_SORT(VALUES(hire_date)) BY month = BUCKET(hire_date, 20, "1985-01-01T00:00:00Z", "1986-01-01T00:00:00Z")\n| SORT hire_date', @@ -869,8 +868,7 @@ const categorizeDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: ['by'], + locationsAvailable: [Location.STATS, Location.STATS_BY], validate: undefined, examples: ['FROM sample_data\n| STATS count=COUNT() BY category=CATEGORIZE(message)'], }; diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/operators.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/operators.ts index 07e2d624bc661..f4e3b8899f3c8 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/operators.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/operators.ts @@ -27,7 +27,7 @@ */ import { i18n } from '@kbn/i18n'; -import { type FunctionDefinition, FunctionDefinitionTypes } from '../types'; +import { type FunctionDefinition, FunctionDefinitionTypes, Location } from '../types'; import { isNumericType } from '../../shared/esql_types'; @@ -369,8 +369,14 @@ const addDefinition: FunctionDefinition = { returnType: 'date', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -537,8 +543,14 @@ const divDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: (fnDef) => { const [left, right] = fnDef.args; const messages = []; @@ -1052,8 +1064,14 @@ const equalsDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -1426,8 +1444,14 @@ const greaterThanDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -1803,8 +1827,14 @@ const greaterThanOrEqualDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -2045,8 +2075,7 @@ const inDefinition: FunctionDefinition = { minParams: 2, }, ], - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: undefined, + locationsAvailable: [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW], validate: undefined, examples: ['ROW a = 1, b = 4, c = 3\n| WHERE c-a IN (3, b / 2, a)'], }; @@ -2419,8 +2448,14 @@ const lessThanDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -2740,8 +2775,14 @@ const lessThanOrEqualDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -2822,8 +2863,7 @@ const likeDefinition: FunctionDefinition = { minParams: 2, }, ], - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: undefined, + locationsAvailable: [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW], validate: undefined, examples: ['FROM employees\n| WHERE first_name LIKE """?b*"""\n| KEEP first_name, last_name'], }; @@ -3333,8 +3373,7 @@ const matchOperatorDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['where'], - supportedOptions: [], + locationsAvailable: [Location.WHERE], validate: undefined, examples: [ 'FROM books \n| WHERE MATCH(author, "Faulkner")\n| KEEP book_no, author \n| SORT book_no \n| LIMIT 5', @@ -3503,8 +3542,14 @@ const modDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: (fnDef) => { const [left, right] = fnDef.args; const messages = []; @@ -3696,8 +3741,14 @@ const mulDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -3763,20 +3814,21 @@ const negDefinition: FunctionDefinition = { returnType: 'time_duration', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics'], - supportedOptions: undefined, + locationsAvailable: [Location.STATS], validate: undefined, examples: [], }; // Do not edit this manually... generated by scripts/generate_function_definitions.ts -const notEqualsDefinition: FunctionDefinition = { +const notInDefinition: FunctionDefinition = { type: FunctionDefinitionTypes.OPERATOR, - name: '!=', - description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_equals', { + name: 'not_in', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_in', { defaultMessage: - 'Check if two fields are unequal. If either field is multivalued then the result is `null`.', + 'The `NOT IN` operator allows testing whether a field or expression does *not* equal any element in a list of literals, fields or expressions.', }), + ignoreAsSuggestion: true, + preview: false, alias: undefined, signatures: [ @@ -3789,11 +3841,12 @@ const notEqualsDefinition: FunctionDefinition = { }, { name: 'right', - type: 'boolean', + type: 'boolean[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ @@ -3804,11 +3857,12 @@ const notEqualsDefinition: FunctionDefinition = { }, { name: 'right', - type: 'cartesian_point', + type: 'cartesian_point[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ @@ -3819,247 +3873,314 @@ const notEqualsDefinition: FunctionDefinition = { }, { name: 'right', - type: 'cartesian_shape', + type: 'cartesian_shape[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'date', + type: 'double', optional: false, }, { name: 'right', - type: 'date', + type: 'double[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'date', + type: 'geo_point', optional: false, }, { name: 'right', - type: 'date_nanos', + type: 'geo_point[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'date_nanos', + type: 'geo_shape', optional: false, }, { name: 'right', - type: 'date', + type: 'geo_shape[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'date_nanos', + type: 'integer', optional: false, }, { name: 'right', - type: 'date_nanos', + type: 'integer[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'double', + type: 'ip', optional: false, }, { name: 'right', - type: 'double', + type: 'ip[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'double', + type: 'keyword', optional: false, }, { name: 'right', - type: 'integer', + type: 'keyword[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'double', + type: 'keyword', optional: false, }, { name: 'right', - type: 'long', + type: 'text[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'geo_point', + type: 'long', optional: false, }, { name: 'right', - type: 'geo_point', + type: 'long[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'geo_shape', + type: 'text', optional: false, }, { name: 'right', - type: 'geo_shape', + type: 'keyword[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'integer', + type: 'text', optional: false, }, { name: 'right', - type: 'double', + type: 'text[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { name: 'left', - type: 'integer', + type: 'version', optional: false, }, { name: 'right', - type: 'integer', + type: 'version[]', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, + ], + locationsAvailable: [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW], + validate: undefined, + examples: [], +}; + +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const notLikeDefinition: FunctionDefinition = { + type: FunctionDefinitionTypes.OPERATOR, + name: 'not_like', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_like', { + defaultMessage: + 'Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.', + }), + preview: false, + alias: undefined, + signatures: [ { params: [ { - name: 'left', - type: 'integer', + name: 'str', + type: 'keyword', optional: false, }, { - name: 'right', - type: 'long', + name: 'pattern', + type: 'keyword', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { - name: 'left', - type: 'ip', + name: 'str', + type: 'text', optional: false, }, { - name: 'right', - type: 'ip', + name: 'pattern', + type: 'keyword', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, + ], + locationsAvailable: [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW], + validate: undefined, + examples: [], +}; + +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const notRlikeDefinition: FunctionDefinition = { + type: FunctionDefinitionTypes.OPERATOR, + name: 'not_rlike', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_rlike', { + defaultMessage: + 'Use `RLIKE` to filter data based on string patterns using using\nregular expressions. `RLIKE` usually acts on a field placed on\nthe left-hand side of the operator, but it can also act on a constant (literal)\nexpression. The right-hand side of the operator represents the pattern.', + }), + preview: false, + alias: undefined, + signatures: [ { params: [ { - name: 'left', + name: 'str', type: 'keyword', optional: false, }, { - name: 'right', + name: 'pattern', type: 'keyword', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, { params: [ { - name: 'left', - type: 'keyword', + name: 'str', + type: 'text', optional: false, }, { - name: 'right', - type: 'text', + name: 'pattern', + type: 'keyword', optional: false, }, ], returnType: 'boolean', + minParams: 2, }, + ], + locationsAvailable: [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW], + validate: undefined, + examples: [], +}; + +// Do not edit this manually... generated by scripts/generate_function_definitions.ts +const notEqualsDefinition: FunctionDefinition = { + type: FunctionDefinitionTypes.OPERATOR, + name: '!=', + description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_equals', { + defaultMessage: + 'Check if two fields are unequal. If either field is multivalued then the result is `null`.', + }), + preview: false, + alias: undefined, + signatures: [ { params: [ { name: 'left', - type: 'long', + type: 'boolean', optional: false, }, { name: 'right', - type: 'double', + type: 'boolean', optional: false, }, ], @@ -4069,12 +4190,12 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'long', + type: 'cartesian_point', optional: false, }, { name: 'right', - type: 'integer', + type: 'cartesian_point', optional: false, }, ], @@ -4084,12 +4205,12 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'long', + type: 'cartesian_shape', optional: false, }, { name: 'right', - type: 'long', + type: 'cartesian_shape', optional: false, }, ], @@ -4099,12 +4220,12 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'text', + type: 'date', optional: false, }, { name: 'right', - type: 'keyword', + type: 'date', optional: false, }, ], @@ -4114,12 +4235,12 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'text', + type: 'date', optional: false, }, { name: 'right', - type: 'text', + type: 'date_nanos', optional: false, }, ], @@ -4129,12 +4250,12 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'unsigned_long', + type: 'date_nanos', optional: false, }, { name: 'right', - type: 'unsigned_long', + type: 'date', optional: false, }, ], @@ -4144,12 +4265,12 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'version', + type: 'date_nanos', optional: false, }, { name: 'right', - type: 'version', + type: 'date_nanos', optional: false, }, ], @@ -4159,12 +4280,13 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'ip', + type: 'double', + optional: false, }, { name: 'right', - type: 'text', - constantOnly: true, + type: 'double', + optional: false, }, ], returnType: 'boolean', @@ -4173,12 +4295,13 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'text', - constantOnly: true, + type: 'double', + optional: false, }, { name: 'right', - type: 'ip', + type: 'integer', + optional: false, }, ], returnType: 'boolean', @@ -4187,12 +4310,13 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'version', + type: 'double', + optional: false, }, { name: 'right', - type: 'text', - constantOnly: true, + type: 'long', + optional: false, }, ], returnType: 'boolean', @@ -4201,12 +4325,13 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'text', - constantOnly: true, + type: 'geo_point', + optional: false, }, { name: 'right', - type: 'version', + type: 'geo_point', + optional: false, }, ], returnType: 'boolean', @@ -4215,11 +4340,13 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'boolean', + type: 'geo_shape', + optional: false, }, { name: 'right', - type: 'boolean', + type: 'geo_shape', + optional: false, }, ], returnType: 'boolean', @@ -4228,12 +4355,13 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'boolean', + type: 'integer', + optional: false, }, { name: 'right', - type: 'keyword', - constantOnly: true, + type: 'double', + optional: false, }, ], returnType: 'boolean', @@ -4242,363 +4370,288 @@ const notEqualsDefinition: FunctionDefinition = { params: [ { name: 'left', - type: 'keyword', - constantOnly: true, + type: 'integer', + optional: false, }, { name: 'right', - type: 'boolean', + type: 'integer', + optional: false, }, ], returnType: 'boolean', }, - ], - 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 notInDefinition: FunctionDefinition = { - type: FunctionDefinitionTypes.OPERATOR, - name: 'not_in', - description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_in', { - defaultMessage: - 'The `NOT IN` operator allows testing whether a field or expression does *not* equal any element in a list of literals, fields or expressions.', - }), - ignoreAsSuggestion: true, - - preview: false, - alias: undefined, - signatures: [ { params: [ { name: 'left', - type: 'boolean', + type: 'integer', optional: false, }, { name: 'right', - type: 'boolean[]', + type: 'long', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'cartesian_point', + type: 'ip', optional: false, }, { name: 'right', - type: 'cartesian_point[]', + type: 'ip', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'cartesian_shape', + type: 'keyword', optional: false, }, { name: 'right', - type: 'cartesian_shape[]', + type: 'keyword', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'double', + type: 'keyword', optional: false, }, { name: 'right', - type: 'double[]', + type: 'text', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'geo_point', + type: 'long', optional: false, }, { name: 'right', - type: 'geo_point[]', + type: 'double', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'geo_shape', + type: 'long', optional: false, }, { name: 'right', - type: 'geo_shape[]', + type: 'integer', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'integer', + type: 'long', optional: false, }, { name: 'right', - type: 'integer[]', + type: 'long', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'ip', + type: 'text', optional: false, }, { name: 'right', - type: 'ip[]', + type: 'keyword', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'keyword', + type: 'text', optional: false, }, { name: 'right', - type: 'keyword[]', + type: 'text', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'keyword', + type: 'unsigned_long', optional: false, }, { name: 'right', - type: 'text[]', + type: 'unsigned_long', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'long', + type: 'version', optional: false, }, { name: 'right', - type: 'long[]', + type: 'version', optional: false, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', - type: 'text', - optional: false, + type: 'ip', }, { name: 'right', - type: 'keyword[]', - optional: false, + type: 'text', + constantOnly: true, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', type: 'text', - optional: false, + constantOnly: true, }, { name: 'right', - type: 'text[]', - optional: false, + type: 'ip', }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { name: 'left', type: 'version', - optional: false, }, { name: 'right', - type: 'version[]', - optional: false, + type: 'text', + constantOnly: true, }, ], returnType: 'boolean', - minParams: 2, }, - ], - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: undefined, - validate: undefined, - examples: [], -}; - -// Do not edit this manually... generated by scripts/generate_function_definitions.ts -const notLikeDefinition: FunctionDefinition = { - type: FunctionDefinitionTypes.OPERATOR, - name: 'not_like', - description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_like', { - defaultMessage: - 'Use `NOT LIKE` to filter data based on string patterns using wildcards. `NOT LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.', - }), - preview: false, - alias: undefined, - signatures: [ { params: [ { - name: 'str', - type: 'keyword', - optional: false, + name: 'left', + type: 'text', + constantOnly: true, }, { - name: 'pattern', - type: 'keyword', - optional: false, + name: 'right', + type: 'version', }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { - name: 'str', - type: 'text', - optional: false, + name: 'left', + type: 'boolean', }, { - name: 'pattern', - type: 'keyword', - optional: false, + name: 'right', + type: 'boolean', }, ], returnType: 'boolean', - minParams: 2, }, - ], - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: undefined, - validate: undefined, - examples: [], -}; - -// Do not edit this manually... generated by scripts/generate_function_definitions.ts -const notRlikeDefinition: FunctionDefinition = { - type: FunctionDefinitionTypes.OPERATOR, - name: 'not_rlike', - description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.not_rlike', { - defaultMessage: - 'Use `NOT RLIKE` to filter data based on string patterns using using\nregular expressions. `NOT RLIKE` usually acts on a field placed on\nthe left-hand side of the operator, but it can also act on a constant (literal)\nexpression. The right-hand side of the operator represents the pattern.', - }), - preview: false, - alias: undefined, - signatures: [ { params: [ { - name: 'str', - type: 'keyword', - optional: false, + name: 'left', + type: 'boolean', }, { - name: 'pattern', + name: 'right', type: 'keyword', - optional: false, + constantOnly: true, }, ], returnType: 'boolean', - minParams: 2, }, { params: [ { - name: 'str', - type: 'text', - optional: false, + name: 'left', + type: 'keyword', + constantOnly: true, }, { - name: 'pattern', - type: 'keyword', - optional: false, + name: 'right', + type: 'boolean', }, ], returnType: 'boolean', - minParams: 2, }, ], - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: undefined, + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; @@ -4679,8 +4732,7 @@ const rlikeDefinition: FunctionDefinition = { minParams: 2, }, ], - supportedCommands: ['eval', 'where', 'row', 'sort'], - supportedOptions: undefined, + locationsAvailable: [Location.EVAL, Location.WHERE, Location.SORT, Location.ROW], validate: undefined, examples: [ 'FROM employees\n| WHERE first_name RLIKE """.leja.*"""\n| KEEP first_name, last_name', @@ -4995,8 +5047,14 @@ const subDefinition: FunctionDefinition = { returnType: 'date', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.STATS, + Location.EVAL, + Location.WHERE, + Location.ROW, + Location.SORT, + Location.STATS_BY, + ], validate: undefined, examples: [], }; 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 aeb267fab470f..534f0d50505c5 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 @@ -28,7 +28,7 @@ import { i18n } from '@kbn/i18n'; import type { ESQLFunction } from '@kbn/esql-ast'; -import { type FunctionDefinition, FunctionDefinitionTypes } from '../types'; +import { type FunctionDefinition, FunctionDefinitionTypes, Location } from '../types'; import { isLiteralItem } from '../../shared/helpers'; // Do not edit this manually... generated by scripts/generate_function_definitions.ts @@ -82,8 +82,15 @@ const absDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW number = -1.0 \n| EVAL abs_number = ABS(number)', @@ -142,8 +149,15 @@ const acosDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=.9\n| EVAL acos=ACOS(a)'], }; @@ -200,8 +214,15 @@ const asinDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=.9\n| EVAL asin=ASIN(a)'], }; @@ -258,8 +279,15 @@ const atanDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=12.9\n| EVAL atan=ATAN(a)'], }; @@ -516,8 +544,15 @@ const atan2Definition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW y=12.9, x=.6\n| EVAL atan2=ATAN2(y, x)'], }; @@ -553,8 +588,15 @@ const bitLengthDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airports\n| WHERE country == "India"\n| KEEP city\n| EVAL fn_length = LENGTH(city), fn_bit_length = BIT_LENGTH(city)', @@ -592,8 +634,15 @@ const byteLengthDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airports\n| WHERE country == "India"\n| KEEP city\n| EVAL fn_length = LENGTH(city), fn_byte_length = BYTE_LENGTH(city)', @@ -652,8 +701,15 @@ const cbrtDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW d = 1000.0\n| EVAL c = cbrt(d)'], }; @@ -709,8 +765,15 @@ const ceilDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8\n| EVAL a=CEIL(a)'], }; @@ -759,8 +822,15 @@ const cidrMatchDefinition: FunctionDefinition = { minParams: 2, }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM hosts \n| WHERE CIDR_MATCH(ip1, "127.0.0.2/32", "127.0.0.3/32") \n| KEEP card, host, ip0, ip1', @@ -1042,8 +1112,15 @@ const coalesceDefinition: FunctionDefinition = { minParams: 1, }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=null, b="b"\n| EVAL COALESCE(a, b)'], }; @@ -1123,8 +1200,15 @@ const concatDefinition: FunctionDefinition = { minParams: 2, }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP first_name, last_name\n| EVAL fullname = CONCAT(first_name, " ", last_name)', @@ -1182,8 +1266,15 @@ const cosDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8 \n| EVAL cos=COS(a)'], }; @@ -1239,8 +1330,15 @@ const coshDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8 \n| EVAL cosh=COSH(a)'], }; @@ -1478,8 +1576,15 @@ const dateDiffDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], 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)', @@ -1590,8 +1695,15 @@ const dateExtractDefinition: FunctionDefinition = { returnType: 'long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW date = DATE_PARSE("yyyy-MM-dd", "2022-05-06")\n| EVAL year = DATE_EXTRACT("year", date)', @@ -1690,8 +1802,15 @@ const dateFormatDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP first_name, last_name, hire_date\n| EVAL hired = DATE_FORMAT("yyyy-MM-dd", hire_date)', @@ -1770,8 +1889,15 @@ const dateParseDefinition: FunctionDefinition = { returnType: 'date', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW date_string = "2022-05-06"\n| EVAL date = DATE_PARSE("yyyy-MM-dd", date_string)'], }; @@ -1847,8 +1973,15 @@ const dateTruncDefinition: FunctionDefinition = { returnType: 'date_nanos', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP first_name, last_name, hire_date\n| EVAL year_hired = DATE_TRUNC(1 year, hire_date)', @@ -1872,8 +2005,15 @@ const eDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW E()'], }; @@ -1950,8 +2090,15 @@ const endsWithDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['FROM employees\n| KEEP last_name\n| EVAL ln_E = ENDS_WITH(last_name, "d")'], }; @@ -2007,8 +2154,15 @@ const expDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW d = 5.0\n| EVAL s = EXP(d)'], }; @@ -2064,8 +2218,15 @@ const floorDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8\n| EVAL a=FLOOR(a)'], }; @@ -2101,8 +2262,15 @@ const fromBase64Definition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['row a = "ZWxhc3RpYw==" \n| eval d = from_base64(a)'], }; @@ -2334,8 +2502,15 @@ const greatestDefinition: FunctionDefinition = { minParams: 1, }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a = 10, b = 20\n| EVAL g = GREATEST(a, b)'], }; @@ -2412,8 +2587,15 @@ const hashDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL md5 = hash("md5", message), sha256 = hash("sha256", message) \n| KEEP message, md5, sha256;', @@ -2672,8 +2854,15 @@ const hypotDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a = 3.0, b = 4.0\n| EVAL c = HYPOT(a, b)'], }; @@ -2709,8 +2898,15 @@ const ipPrefixDefinition: FunctionDefinition = { returnType: 'ip', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'row ip4 = to_ip("1.2.3.4"), ip6 = to_ip("fe80::cae2:65ff:fece:feb9")\n| eval ip4_prefix = ip_prefix(ip4, 24, 0), ip6_prefix = ip_prefix(ip6, 0, 112);', @@ -2751,8 +2947,7 @@ const kqlDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['where'], - supportedOptions: [], + locationsAvailable: [Location.WHERE], validate: undefined, examples: [ 'FROM books \n| WHERE KQL("author: Faulkner")\n| KEEP book_no, author \n| SORT book_no \n| LIMIT 5', @@ -2987,8 +3182,15 @@ const leastDefinition: FunctionDefinition = { minParams: 1, }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a = 10, b = 20\n| EVAL l = LEAST(a, b)'], }; @@ -3035,8 +3237,15 @@ const leftDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP last_name\n| EVAL left = LEFT(last_name, 3)\n| SORT last_name ASC\n| LIMIT 5', @@ -3074,8 +3283,15 @@ const lengthDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airports\n| WHERE country == "India"\n| KEEP city\n| EVAL fn_length = LENGTH(city)', @@ -3234,8 +3450,15 @@ const locateDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['row a = "hello"\n| eval a_ll = locate(a, "ll")'], }; @@ -3532,8 +3755,15 @@ const logDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: (fnDef: ESQLFunction) => { const messages = []; // do not really care here about the base and field @@ -3616,8 +3846,15 @@ const log10Definition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: (fnDef: ESQLFunction) => { const messages = []; // do not really care here about the base and field @@ -3676,8 +3913,15 @@ const ltrimDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW message = " some text ", color = " red "\n| EVAL message = LTRIM(message)\n| EVAL color = LTRIM(color)\n| EVAL message = CONCAT("\'", message, "\'")\n| EVAL color = CONCAT("\'", color, "\'")', @@ -3713,7 +3957,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3738,7 +3982,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3763,7 +4007,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3788,7 +4032,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3813,7 +4057,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3838,7 +4082,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3863,7 +4107,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3888,7 +4132,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3913,7 +4157,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3938,7 +4182,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3963,7 +4207,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -3988,7 +4232,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4013,7 +4257,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4038,7 +4282,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4063,7 +4307,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4088,7 +4332,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4113,7 +4357,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4138,7 +4382,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4163,7 +4407,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4188,7 +4432,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4213,7 +4457,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4238,7 +4482,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4263,7 +4507,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4288,7 +4532,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4313,7 +4557,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4338,7 +4582,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4363,7 +4607,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4388,7 +4632,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4413,7 +4657,7 @@ const matchDefinition: FunctionDefinition = { name: 'options', type: 'function_named_parameters', mapParams: - "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value. Defaults to OR.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand. Defaults to 50.'}", + "{name='fuzziness', values=[AUTO, 1, 2], description='Maximum edit distance allowed for matching.'}, {name='auto_generate_synonyms_phrase_query', values=[true, false], description='If true, match phrase queries are automatically created for multi-term synonyms.'}, {name='analyzer', values=[standard], description='Analyzer used to convert the text in the query value into token.'}, {name='minimum_should_match', values=[2], description='Minimum number of clauses that must match for a document to be returned.'}, {name='zero_terms_query', values=[none, all], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='boost', values=[2.5], description='Floating point number used to decrease or increase the relevance scores of the query.'}, {name='fuzzy_transpositions', values=[true, false], description='If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).'}, {name='fuzzy_rewrite', values=[constant_score_blended, constant_score, constant_score_boolean, top_terms_blended_freqs_N, top_terms_boost_N, top_terms_N], description='Method used to rewrite the query. See the rewrite parameter for valid values and more information.'}, {name='prefix_length', values=[1], description='Number of beginning characters left unchanged for fuzzy matching.'}, {name='lenient', values=[true, false], description='If false, format-based errors, such as providing a text query value for a numeric field, are returned.'}, {name='operator', values=[AND, OR], description='Boolean logic used to interpret text in the query value.'}, {name='max_expansions', values=[50], description='Maximum number of terms to which the query will expand.'}", optional: true, constantOnly: true, }, @@ -4421,8 +4665,7 @@ const matchDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['where'], - supportedOptions: [], + locationsAvailable: [Location.WHERE], validate: undefined, examples: [ 'FROM books \n| WHERE MATCH(author, "Faulkner")\n| KEEP book_no, author \n| SORT book_no \n| LIMIT 5', @@ -4461,8 +4704,15 @@ const md5Definition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL md5 = md5(message)\n| KEEP message, md5;', @@ -4735,8 +4985,15 @@ const mvAppendDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [], }; @@ -4793,8 +5050,15 @@ const mvAvgDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=[3, 5, 1, 6]\n| EVAL avg_a = MV_AVG(a)'], }; @@ -4871,8 +5135,15 @@ const mvConcatDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW a=["foo", "zoo", "bar"]\n| EVAL j = MV_CONCAT(a, ", ")', @@ -5042,8 +5313,15 @@ const mvCountDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=["foo", "zoo", "bar"]\n| EVAL count_a = MV_COUNT(a)'], }; @@ -5209,8 +5487,15 @@ const mvDedupeDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=["foo", "foo", "bar", "foo"]\n| EVAL dedupe_a = MV_DEDUPE(a)'], }; @@ -5377,8 +5662,15 @@ const mvFirstDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a="foo;bar;baz"\n| EVAL first_a = MV_FIRST(SPLIT(a, ";"))'], }; @@ -5545,8 +5837,15 @@ const mvLastDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a="foo;bar;baz"\n| EVAL last_a = MV_LAST(SPLIT(a, ";"))'], }; @@ -5673,8 +5972,15 @@ const mvMaxDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW a=[3, 5, 1]\n| EVAL max_a = MV_MAX(a)', @@ -5734,8 +6040,15 @@ const mvMedianDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW a=[3, 5, 1]\n| EVAL median_a = MV_MEDIAN(a)', @@ -5798,8 +6111,15 @@ const mvMedianAbsoluteDeviationDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW values = [0, 2, 5, 6]\n| EVAL median_absolute_deviation = MV_MEDIAN_ABSOLUTE_DEVIATION(values), median = MV_MEDIAN(values)', @@ -5928,8 +6248,15 @@ const mvMinDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW a=[2, 1]\n| EVAL min_a = MV_MIN(a)', @@ -6084,8 +6411,15 @@ const mvPercentileDefinition: FunctionDefinition = { returnType: 'long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW values = [5, 5, 10, 12, 5000]\n| EVAL p50 = MV_PERCENTILE(values, 50), median = MV_MEDIAN(values)', @@ -6122,8 +6456,15 @@ const mvPseriesWeightedSumDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW a = [70.0, 45.0, 21.0, 21.0, 21.0]\n| EVAL sum = MV_PSERIES_WEIGHTED_SUM(a, 1.5)\n| KEEP sum', @@ -6442,8 +6783,15 @@ const mvSliceDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'row a = [1, 2, 2, 3]\n| eval a1 = mv_slice(a, 1), a2 = mv_slice(a, 2, 3)', @@ -6622,8 +6970,15 @@ const mvSortDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a = [4, 2, -3, 2]\n| EVAL sa = mv_sort(a), sd = mv_sort(a, "DESC")'], }; @@ -6680,8 +7035,15 @@ const mvSumDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=[3, 5, 6]\n| EVAL sum_a = MV_SUM(a)'], }; @@ -6918,8 +7280,15 @@ const mvZipDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW a = ["x", "y", "z"], b = ["1", "2"]\n| EVAL c = mv_zip(a, b, "-")\n| KEEP a, b, c', @@ -6941,8 +7310,15 @@ const nowDefinition: FunctionDefinition = { returnType: 'date', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW current_date = NOW()', 'FROM sample_data\n| WHERE @timestamp > NOW() - 1 hour'], }; @@ -6962,8 +7338,15 @@ const piDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW PI()'], }; @@ -7219,8 +7602,15 @@ const powDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW base = 2.0, exponent = 2\n| EVAL result = POW(base, exponent)', @@ -7278,8 +7668,7 @@ const qstrDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['where'], - supportedOptions: [], + locationsAvailable: [Location.WHERE], validate: undefined, examples: [ 'FROM books \n| WHERE QSTR("author: Faulkner")\n| KEEP book_no, author \n| SORT book_no \n| LIMIT 5', @@ -7329,8 +7718,15 @@ const repeatDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a = "Hello!"\n| EVAL triple_a = REPEAT(a, 3)'], }; @@ -7507,8 +7903,15 @@ const replaceDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW str = "Hello World"\n| EVAL str = REPLACE(str, "World", "Universe")\n| KEEP str'], }; @@ -7544,8 +7947,15 @@ const reverseDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW message = "Some Text" | EVAL message_reversed = REVERSE(message);', @@ -7595,8 +8005,15 @@ const rightDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP last_name\n| EVAL right = RIGHT(last_name, 3)\n| SORT last_name ASC\n| LIMIT 5', @@ -7775,8 +8192,15 @@ const roundDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP first_name, last_name, height\n| EVAL height_ft = ROUND(height * 3.281, 1)', @@ -7814,8 +8238,15 @@ const rtrimDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW message = " some text ", color = " red "\n| EVAL message = RTRIM(message)\n| EVAL color = RTRIM(color)\n| EVAL message = CONCAT("\'", message, "\'")\n| EVAL color = CONCAT("\'", color, "\'")', @@ -7853,8 +8284,15 @@ const sha1Definition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL sha1 = sha1(message)\n| KEEP message, sha1;', @@ -7892,8 +8330,15 @@ const sha256Definition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM sample_data \n| WHERE message != "Connection error"\n| EVAL sha256 = sha256(message)\n| KEEP message, sha256;', @@ -7952,8 +8397,15 @@ const signumDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW d = 100.0\n| EVAL s = SIGNUM(d)'], }; @@ -8009,8 +8461,15 @@ const sinDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8 \n| EVAL sin=SIN(a)'], }; @@ -8066,8 +8525,15 @@ const sinhDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8 \n| EVAL sinh=SINH(a)'], }; @@ -8093,8 +8559,15 @@ const spaceDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW message = CONCAT("Hello", SPACE(1), "World!");'], }; @@ -8170,8 +8643,15 @@ const splitDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW words="foo;bar;baz;qux;quux;corge"\n| EVAL word = SPLIT(words, ";")'], }; @@ -8228,8 +8708,15 @@ const sqrtDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW d = 100.0\n| EVAL s = SQRT(d)'], }; @@ -8366,8 +8853,15 @@ const stContainsDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airport_city_boundaries\n| WHERE ST_CONTAINS(city_boundary, TO_GEOSHAPE("POLYGON((109.35 18.3, 109.45 18.3, 109.45 18.4, 109.35 18.4, 109.35 18.3))"))\n| KEEP abbrev, airport, region, city, city_location', @@ -8506,8 +9000,15 @@ const stDisjointDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airport_city_boundaries\n| WHERE ST_DISJOINT(city_boundary, TO_GEOSHAPE("POLYGON((-10 -60, 120 -60, 120 60, -10 60, -10 -60))"))\n| KEEP abbrev, airport, region, city, city_location', @@ -8556,8 +9057,15 @@ const stDistanceDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airports\n| WHERE abbrev == "CPH"\n| EVAL distance = ST_DISTANCE(location, city_location)\n| KEEP abbrev, name, location, city_location, distance', @@ -8615,8 +9123,15 @@ const stEnvelopeDefinition: FunctionDefinition = { returnType: 'geo_shape', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airport_city_boundaries\n| WHERE abbrev == "CPH"\n| EVAL envelope = ST_ENVELOPE(city_boundary)\n| KEEP abbrev, airport, envelope', @@ -8755,8 +9270,15 @@ const stIntersectsDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airports\n| WHERE ST_INTERSECTS(location, TO_GEOSHAPE("POLYGON((42 14, 43 14, 43 15, 42 15, 42 14))"))', @@ -8895,8 +9417,15 @@ const stWithinDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM airport_city_boundaries\n| WHERE ST_WITHIN(city_boundary, TO_GEOSHAPE("POLYGON((109.1 18.15, 109.6 18.15, 109.6 18.65, 109.1 18.65, 109.1 18.15))"))\n| KEEP abbrev, airport, region, city, city_location', @@ -8935,8 +9464,15 @@ const stXDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW point = TO_GEOPOINT("POINT(42.97109629958868 14.7552534006536)")\n| EVAL x = ST_X(point), y = ST_Y(point)', @@ -8995,8 +9531,15 @@ const stXmaxDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], 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', @@ -9055,8 +9598,15 @@ const stXminDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], 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', @@ -9095,8 +9645,15 @@ const stYDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW point = TO_GEOPOINT("POINT(42.97109629958868 14.7552534006536)")\n| EVAL x = ST_X(point), y = ST_Y(point)', @@ -9155,8 +9712,15 @@ const stYmaxDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], 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', @@ -9215,8 +9779,15 @@ const stYminDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], 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', @@ -9295,8 +9866,15 @@ const startsWithDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['FROM employees\n| KEEP last_name\n| EVAL ln_S = STARTS_WITH(last_name, "B")'], }; @@ -9353,8 +9931,15 @@ const substringDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'FROM employees\n| KEEP last_name\n| EVAL ln_sub = SUBSTRING(last_name, 1, 3)', @@ -9414,8 +9999,15 @@ const tanDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8 \n| EVAL tan=TAN(a)'], }; @@ -9471,8 +10063,15 @@ const tanhDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=1.8 \n| EVAL tanh=TANH(a)'], }; @@ -9492,8 +10091,15 @@ const tauDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW TAU()'], }; @@ -9572,29 +10178,19 @@ const termDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], 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 toAggregateMetricDoubleDefinition: FunctionDefinition = { - type: FunctionDefinitionTypes.SCALAR, - name: 'to_aggregate_metric_double', - description: i18n.translate( - 'kbn-esql-validation-autocomplete.esql.definitions.to_aggregate_metric_double', - { defaultMessage: 'Encode a numeric to an aggregate_metric_double.' } - ), - preview: false, - alias: undefined, - signatures: [], - 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 toBase64Definition: FunctionDefinition = { type: FunctionDefinitionTypes.SCALAR, @@ -9626,8 +10222,15 @@ const toBase64Definition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['row a = "elastic" \n| eval e = to_base64(a)'], }; @@ -9714,8 +10317,15 @@ const toBooleanDefinition: FunctionDefinition = { returnType: 'boolean', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW str = ["true", "TRuE", "false", "", "yes", "1"]\n| EVAL bool = TO_BOOLEAN(str)'], }; @@ -9765,8 +10375,15 @@ const toCartesianpointDefinition: FunctionDefinition = { returnType: 'cartesian_point', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW wkt = ["POINT(4297.11 -1475.53)", "POINT(7580.93 2272.77)"]\n| MV_EXPAND wkt\n| EVAL pt = TO_CARTESIANPOINT(wkt)', @@ -9828,8 +10445,15 @@ const toCartesianshapeDefinition: FunctionDefinition = { returnType: 'cartesian_shape', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW wkt = ["POINT(4297.11 -1475.53)", "POLYGON ((3339584.72 1118889.97, 4452779.63 4865942.27, 2226389.81 4865942.27, 1113194.90 2273030.92, 3339584.72 1118889.97))"]\n| MV_EXPAND wkt\n| EVAL geom = TO_CARTESIANSHAPE(wkt)', @@ -9917,8 +10541,15 @@ const toDateNanosDefinition: FunctionDefinition = { returnType: 'date_nanos', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [], }; @@ -9964,8 +10595,15 @@ const toDateperiodDefinition: FunctionDefinition = { returnType: 'date_period', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'row x = "2024-01-01"::datetime | eval y = x + "3 DAYS"::date_period, z = x - to_dateperiod("3 days");', @@ -10064,8 +10702,15 @@ const toDatetimeDefinition: FunctionDefinition = { returnType: 'date', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW string = ["1953-09-02T00:00:00.000Z", "1964-06-02T00:00:00.000Z", "1964-06-02 00:00:00"]\n| EVAL datetime = TO_DATETIME(string)', @@ -10124,8 +10769,15 @@ const toDegreesDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW rad = [1.57, 3.14, 4.71]\n| EVAL deg = TO_DEGREES(rad)'], }; @@ -10252,8 +10904,15 @@ const toDoubleDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW str1 = "5.20128E11", str2 = "foo"\n| EVAL dbl = TO_DOUBLE("520128000000"), dbl1 = TO_DOUBLE(str1), dbl2 = TO_DOUBLE(str2)', @@ -10302,8 +10961,15 @@ const toGeopointDefinition: FunctionDefinition = { returnType: 'geo_point', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW wkt = "POINT(42.97109630194 14.7552534413725)"\n| EVAL pt = TO_GEOPOINT(wkt)'], }; @@ -10360,8 +11026,15 @@ const toGeoshapeDefinition: FunctionDefinition = { returnType: 'geo_shape', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW wkt = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"\n| EVAL geom = TO_GEOSHAPE(wkt)', @@ -10470,8 +11143,15 @@ const toIntegerDefinition: FunctionDefinition = { returnType: 'integer', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW long = [5013792, 2147483647, 501379200000]\n| EVAL int = TO_INTEGER(long)'], }; @@ -10517,8 +11197,15 @@ const toIpDefinition: FunctionDefinition = { returnType: 'ip', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW str1 = "1.1.1.1", str2 = "foo"\n| EVAL ip1 = TO_IP(str1), ip2 = TO_IP(str2)\n| WHERE CIDR_MATCH(ip1, "1.0.0.0/8")', @@ -10647,8 +11334,15 @@ const toLongDefinition: FunctionDefinition = { returnType: 'long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW str1 = "2147483648", str2 = "2147483648.2", str3 = "foo"\n| EVAL long1 = TO_LONG(str1), long2 = TO_LONG(str2), long3 = TO_LONG(str3)', @@ -10686,8 +11380,15 @@ const toLowerDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW message = "Some Text"\n| EVAL message_lower = TO_LOWER(message)', @@ -10746,8 +11447,15 @@ const toRadiansDefinition: FunctionDefinition = { returnType: 'double', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW deg = [90.0, 180.0, 270.0]\n| EVAL rad = TO_RADIANS(deg)'], }; @@ -10913,8 +11621,15 @@ const toStringDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW a=10\n| EVAL j = TO_STRING(a)', 'ROW a=[10, 9, 8]\n| EVAL j = TO_STRING(a)'], }; @@ -10960,8 +11675,15 @@ const toTimedurationDefinition: FunctionDefinition = { returnType: 'time_duration', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'row x = "2024-01-01"::datetime | eval y = x + "3 hours"::time_duration, z = x - to_timeduration("3 hours");', @@ -11063,8 +11785,15 @@ const toUnsignedLongDefinition: FunctionDefinition = { returnType: 'unsigned_long', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW str1 = "2147483648", str2 = "2147483648.2", str3 = "foo"\n| EVAL long1 = TO_UNSIGNED_LONG(str1), long2 = TO_ULONG(str2), long3 = TO_UL(str3)', @@ -11102,8 +11831,15 @@ const toUpperDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW message = "Some Text"\n| EVAL message_upper = TO_UPPER(message)'], }; @@ -11149,8 +11885,15 @@ const toVersionDefinition: FunctionDefinition = { returnType: 'version', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: ['ROW v = TO_VERSION("1.2.3")'], }; @@ -11186,8 +11929,15 @@ const trimDefinition: FunctionDefinition = { returnType: 'keyword', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'ROW message = " some text ", color = " red "\n| EVAL message = TRIM(message)\n| EVAL color = TRIM(color)', @@ -11220,8 +11970,15 @@ const caseDefinition: FunctionDefinition = { returnType: 'unknown', }, ], - supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'], - supportedOptions: ['by'], + locationsAvailable: [ + Location.EVAL, + Location.ROW, + Location.SORT, + Location.WHERE, + Location.STATS, + Location.STATS_BY, + Location.STATS_WHERE, + ], validate: undefined, examples: [ 'from index | eval type = case(languages <= 1, "monolingual", languages <= 2, "bilingual", "polyglot")', @@ -11319,7 +12076,6 @@ export const scalarFunctionDefinitions = [ tanhDefinition, tauDefinition, termDefinition, - toAggregateMetricDoubleDefinition, toBase64Definition, toBooleanDefinition, toCartesianpointDefinition, diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/types.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/types.ts index 6317b3abdf1da..a4d93cacf9d7a 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/types.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/types.ts @@ -176,6 +176,103 @@ export enum FunctionDefinitionTypes { GROUPING = 'grouping', } +/** + * This is a list of locations within an ES|QL query. + * + * It is currently used to suggest appropriate functions and + * operators given the location of the cursor. + */ +export enum Location { + /** + * In the top-level EVAL command + */ + EVAL = 'eval', + + /** + * In the top-level WHERE command + */ + WHERE = 'where', + + /** + * In the top-level ROW command + */ + ROW = 'row', + + /** + * In the top-level SORT command + */ + SORT = 'sort', + + /** + * In the top-level STATS command + */ + STATS = 'stats', + + /** + * In a grouping clause + */ + STATS_BY = 'stats_by', + + /** + * In a per-agg filter + */ + STATS_WHERE = 'stats_where', + + /** + * Top-level ENRICH command + */ + ENRICH = 'enrich', + + /** + * ENRICH...WITH clause + */ + ENRICH_WITH = 'enrich_with', + + /** + * In the top-level DISSECT command (used only for + * assignment in APPEND_SEPARATOR) + */ + DISSECT = 'dissect', + + /** + * In RENAME (used only for AS) + */ + RENAME = 'rename', + + /** + * In the JOIN command (used only for AS) + */ + JOIN = 'join', + + /** + * In the SHOW command + */ + SHOW = 'show', +} + +const commandOptionNameToLocation: Record = { + eval: Location.EVAL, + where: Location.WHERE, + row: Location.ROW, + sort: Location.SORT, + stats: Location.STATS, + by: Location.STATS_BY, + enrich: Location.ENRICH, + with: Location.ENRICH_WITH, + dissect: Location.DISSECT, + rename: Location.RENAME, + join: Location.JOIN, + show: Location.SHOW, +}; + +/** + * Pause before using this in new places. Where possible, use the Location enum directly. + * + * This is primarily around for backwards compatibility with the old system of command and option names. + */ +export const getLocationFromCommandOrOptionName = (name: string) => + commandOptionNameToLocation[name]; + export interface FunctionDefinition { type: FunctionDefinitionTypes; preview?: boolean; @@ -183,8 +280,7 @@ export interface FunctionDefinition { name: string; alias?: string[]; description: string; - supportedCommands: string[]; - supportedOptions?: string[]; + locationsAvailable: Location[]; signatures: Signature[]; examples?: string[]; validate?: (fnDef: ESQLFunction) => ESQLMessage[]; diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.test.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.test.ts index b4e3deb664e1e..a33cf20ad387e 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.test.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.test.ts @@ -9,7 +9,7 @@ import { parse } from '@kbn/esql-ast'; import { getBracketsToClose, getExpressionType, shouldBeQuotedSource } from './helpers'; -import { SupportedDataType, FunctionDefinitionTypes } from '../definitions/types'; +import { SupportedDataType, FunctionDefinitionTypes, Location } from '../definitions/types'; import { setTestFunctions } from './test_functions'; describe('shouldBeQuotedSource', () => { @@ -187,7 +187,7 @@ describe('getExpressionType', () => { type: FunctionDefinitionTypes.SCALAR, name: 'test', description: 'Test function', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg', type: 'keyword' }], returnType: 'keyword' }, { params: [{ name: 'arg', type: 'double' }], returnType: 'double' }, @@ -204,14 +204,14 @@ describe('getExpressionType', () => { type: FunctionDefinitionTypes.SCALAR, name: 'returns_keyword', description: 'Test function', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [{ params: [], returnType: 'keyword' }], }, { type: FunctionDefinitionTypes.SCALAR, name: 'accepts_dates', description: 'Test function', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [ @@ -300,7 +300,7 @@ describe('getExpressionType', () => { type: FunctionDefinitionTypes.SCALAR, name: 'test', description: 'Test function', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [{ params: [{ name: 'arg', type: 'any' }], returnType: 'keyword' }], }, ]); diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.ts index 3c217f114a495..d8e592c6a6aed 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/shared/helpers.ts @@ -41,6 +41,7 @@ import { ArrayType, SupportedDataType, FunctionDefinitionTypes, + getLocationFromCommandOrOptionName, } from '../definitions/types'; import type { ESQLRealField, ESQLVariable, ReferenceMaps } from '../validation/types'; import { removeMarkerArgFromArgsList } from './context'; @@ -164,9 +165,7 @@ export function isSupportedFunction( } const fn = buildFunctionLookup().get(name); const isSupported = Boolean( - option == null - ? fn?.supportedCommands.includes(parentCommand) - : fn?.supportedOptions?.includes(option) + fn?.locationsAvailable.includes(getLocationFromCommandOrOptionName(option ?? parentCommand)) ); return { supported: isSupported, diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/fields_and_variables.test.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/fields_and_variables.test.ts index 8a6313255c1af..c8dc1d21d5c7c 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/fields_and_variables.test.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/fields_and_variables.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { FunctionParameterType, FunctionDefinitionTypes } from '../../definitions/types'; +import { FunctionParameterType, FunctionDefinitionTypes, Location } from '../../definitions/types'; import { setTestFunctions } from '../../shared/test_functions'; import { setup } from './helpers'; @@ -119,7 +119,7 @@ describe('variable support', () => { { type: FunctionDefinitionTypes.SCALAR, description: 'Test function', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], name: 'test', signatures: [ { params: [{ name: 'arg', type: 'cartesian_point' }], returnType: 'cartesian_point' }, @@ -130,7 +130,7 @@ describe('variable support', () => { { type: FunctionDefinitionTypes.SCALAR, description: 'Test function', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], name: 'return_value', signatures: [ { params: [{ name: 'arg', type: 'text' }], returnType: 'text' }, diff --git a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts index 8b16ea7e3dd26..4a403e8711b47 100644 --- a/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts +++ b/src/platform/packages/shared/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { FunctionDefinition, FunctionDefinitionTypes } from '../../definitions/types'; +import { FunctionDefinition, FunctionDefinitionTypes, Location } from '../../definitions/types'; import { setTestFunctions } from '../../shared/test_functions'; import { setup } from './helpers'; @@ -25,7 +25,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'integer' }], @@ -41,7 +41,7 @@ describe('function validation', () => { name: 'returns_integer', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [], @@ -53,7 +53,7 @@ describe('function validation', () => { name: 'returns_double', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [], @@ -147,7 +147,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'any' }], @@ -172,7 +172,7 @@ describe('function validation', () => { name: 'in', type: FunctionDefinitionTypes.OPERATOR, description: '', - supportedCommands: ['row'], + locationsAvailable: [Location.ROW], signatures: [ { params: [ @@ -200,7 +200,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [ @@ -271,7 +271,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword' }], @@ -290,7 +290,7 @@ describe('function validation', () => { name: 'variadic_fn', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'integer' }], @@ -329,7 +329,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [ @@ -356,7 +356,7 @@ describe('function validation', () => { name: 'supports_all', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword', supportsWildcard: true }], @@ -368,7 +368,7 @@ describe('function validation', () => { name: 'does_not_support_all', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword', supportsWildcard: false }], @@ -399,7 +399,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [ @@ -430,7 +430,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'integer', constantOnly: true }], @@ -442,7 +442,7 @@ describe('function validation', () => { name: 'test2', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [ @@ -478,7 +478,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword', acceptedValues: ['ASC', 'DESC'] }], @@ -512,7 +512,7 @@ describe('function validation', () => { name: 'test1', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword' }], @@ -524,7 +524,7 @@ describe('function validation', () => { name: 'test2', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword' }], @@ -536,7 +536,7 @@ describe('function validation', () => { name: 'test3', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'long' }], @@ -563,7 +563,7 @@ describe('function validation', () => { name: 'eval_fn', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [], @@ -575,7 +575,7 @@ describe('function validation', () => { name: 'stats_fn', type: FunctionDefinitionTypes.AGG, description: '', - supportedCommands: ['stats'], + locationsAvailable: [Location.STATS], signatures: [ { params: [], @@ -587,7 +587,7 @@ describe('function validation', () => { name: 'row_fn', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['row'], + locationsAvailable: [Location.ROW], signatures: [ { params: [], @@ -599,7 +599,7 @@ describe('function validation', () => { name: 'where_fn', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['where'], + locationsAvailable: [Location.WHERE], signatures: [ { params: [], @@ -611,7 +611,7 @@ describe('function validation', () => { name: 'sort_fn', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['sort'], + locationsAvailable: [Location.SORT], signatures: [ { params: [], @@ -651,8 +651,7 @@ describe('function validation', () => { name: 'supports_by_option', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], - supportedOptions: ['by'], + locationsAvailable: [Location.EVAL, Location.STATS_BY], signatures: [ { params: [], @@ -664,8 +663,7 @@ describe('function validation', () => { name: 'does_not_support_by_option', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], - supportedOptions: [], + locationsAvailable: [Location.EVAL], signatures: [ { params: [], @@ -678,8 +676,7 @@ describe('function validation', () => { name: 'agg_fn', type: FunctionDefinitionTypes.AGG, description: '', - supportedCommands: ['stats'], - supportedOptions: [], + locationsAvailable: [Location.STATS], signatures: [ { params: [], @@ -705,7 +702,7 @@ describe('function validation', () => { name: 'test', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'keyword' }], @@ -717,7 +714,7 @@ describe('function validation', () => { name: 'test2', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['eval'], + locationsAvailable: [Location.EVAL], signatures: [ { params: [{ name: 'arg1', type: 'integer' }], @@ -738,7 +735,7 @@ describe('function validation', () => { name: 'agg_fn', type: FunctionDefinitionTypes.AGG, description: '', - supportedCommands: ['stats'], + locationsAvailable: [Location.STATS], signatures: [ { params: [{ name: 'arg1', type: 'keyword' }], @@ -750,7 +747,7 @@ describe('function validation', () => { name: 'scalar_fn', type: FunctionDefinitionTypes.SCALAR, description: '', - supportedCommands: ['stats'], + locationsAvailable: [Location.STATS], signatures: [ { params: [{ name: 'arg1', type: 'keyword' }],