Skip to content

Commit

Permalink
[ES|QL] Update function metadata (elastic#196993)
Browse files Browse the repository at this point in the history
This PR updates the function definitions and inline docs based on the
latest metadata from Elasticsearch.

---------

Co-authored-by: Stratoula Kalafateli <[email protected]>
  • Loading branch information
kibanamachine and stratoula authored Oct 21, 2024
1 parent b76da4e commit ad91668
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ describe('autocomplete.suggest', () => {
// // Test suggestions for each possible param, within each signature variation, for each function
for (const fn of scalarFunctionDefinitions) {
// skip this fn for the moment as it's quite hard to test
// if (!['bucket', 'date_extract', 'date_diff', 'case'].includes(fn.name)) {
if (!['bucket', 'date_extract', 'date_diff', 'case'].includes(fn.name)) {
// Add match in the text when the autocomplete is ready https:/elastic/kibana/issues/196995
if (!['bucket', 'date_extract', 'date_diff', 'case', 'match'].includes(fn.name)) {
test(`${fn.name}`, async () => {
const testedCases = new Set<string>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3209,6 +3209,85 @@ const ltrimDefinition: FunctionDefinition = {
],
};

// Do not edit this manually... generated by scripts/generate_function_definitions.ts
const matchDefinition: FunctionDefinition = {
type: 'eval',
name: 'match',
description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.match', {
defaultMessage:
'Performs a match query on the specified field. Returns true if the provided query matches the row.',
}),
alias: undefined,
signatures: [
{
params: [
{
name: 'field',
type: 'keyword',
optional: false,
},
{
name: 'query',
type: 'keyword',
optional: false,
},
],
returnType: 'boolean',
},
{
params: [
{
name: 'field',
type: 'keyword',
optional: false,
},
{
name: 'query',
type: 'text',
optional: false,
},
],
returnType: 'boolean',
},
{
params: [
{
name: 'field',
type: 'text',
optional: false,
},
{
name: 'query',
type: 'keyword',
optional: false,
},
],
returnType: 'boolean',
},
{
params: [
{
name: 'field',
type: 'text',
optional: false,
},
{
name: 'query',
type: 'text',
optional: false,
},
],
returnType: 'boolean',
},
],
supportedCommands: ['stats', 'inlinestats', 'metrics', 'eval', 'where', 'row', 'sort'],
supportedOptions: ['by'],
validate: undefined,
examples: [
'from books \n| where match(author, "Faulkner")\n| keep book_no, author \n| sort book_no \n| limit 5;',
],
};

// Do not edit this manually... generated by scripts/generate_function_definitions.ts
const mvAppendDefinition: FunctionDefinition = {
type: 'eval',
Expand Down Expand Up @@ -5770,8 +5849,6 @@ const qstrDefinition: FunctionDefinition = {
defaultMessage:
'Performs a query string query. Returns true if the provided query string matches the row.',
}),
ignoreAsSuggestion: true,

alias: undefined,
signatures: [
{
Expand Down Expand Up @@ -9077,6 +9154,7 @@ export const scalarFunctionDefinitions = [
logDefinition,
log10Definition,
ltrimDefinition,
matchDefinition,
mvAppendDefinition,
mvAvgDefinition,
mvConcatDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,42 @@ export const functions = {
| EVAL message = CONCAT("'", message, "'")
| EVAL color = CONCAT("'", color, "'")
\`\`\`
`,
description:
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
ignoreTag: true,
}
)}
/>
),
},
// Do not edit manually... automatically generated by scripts/generate_esql_docs.ts
{
label: i18n.translate('languageDocumentation.documentationESQL.match', {
defaultMessage: 'MATCH',
}),
description: (
<Markdown
openLinksInNewTab
readOnly
enableSoftLineBreaks
markdownContent={i18n.translate(
'languageDocumentation.documentationESQL.match.markdown',
{
defaultMessage: `<!--
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-->
### MATCH
Performs a match query on the specified field. Returns true if the provided query matches the row.
\`\`\`
from books
| where match(author, "Faulkner")
| keep book_no, author
| sort book_no
| limit 5;
\`\`\`
`,
description:
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
Expand Down Expand Up @@ -1801,6 +1837,39 @@ export const functions = {
| EVAL result = POW(base, exponent)
\`\`\`
Note: It is still possible to overflow a double result here; in that case, null will be returned.
`,
description:
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
ignoreTag: true,
})}
/>
),
},
// Do not edit manually... automatically generated by scripts/generate_esql_docs.ts
{
label: i18n.translate('languageDocumentation.documentationESQL.qstr', {
defaultMessage: 'QSTR',
}),
description: (
<Markdown
openLinksInNewTab
readOnly
enableSoftLineBreaks
markdownContent={i18n.translate('languageDocumentation.documentationESQL.qstr.markdown', {
defaultMessage: `<!--
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-->
### QSTR
Performs a query string query. Returns true if the provided query string matches the row.
\`\`\`
from books
| where qstr("author: Faulkner")
| keep book_no, author
| sort book_no
| limit 5;
\`\`\`
`,
description:
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
Expand Down

0 comments on commit ad91668

Please sign in to comment.