Skip to content

Commit

Permalink
[8.16] [ES|QL] Update function metadata (#196993) (#197005)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.16`:
- [[ES|QL] Update function metadata
(#196993)](#196993)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kibana
Machine","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-21T08:44:31Z","message":"[ES|QL]
Update function metadata (#196993)\n\nThis PR updates the function
definitions and inline docs based on the\r\nlatest metadata from
Elasticsearch.\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula
Kalafateli
<[email protected]>","sha":"ad916685fc2fb8581678043efd330a679a0a8f06","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:ES|QL","Team:ESQL","v8.16.0","backport:version","v8.17.0"],"title":"[ES|QL]
Update function
metadata","number":196993,"url":"https://github.com/elastic/kibana/pull/196993","mergeCommit":{"message":"[ES|QL]
Update function metadata (#196993)\n\nThis PR updates the function
definitions and inline docs based on the\r\nlatest metadata from
Elasticsearch.\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula
Kalafateli
<[email protected]>","sha":"ad916685fc2fb8581678043efd330a679a0a8f06"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196993","number":196993,"mergeCommit":{"message":"[ES|QL]
Update function metadata (#196993)\n\nThis PR updates the function
definitions and inline docs based on the\r\nlatest metadata from
Elasticsearch.\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula
Kalafateli
<[email protected]>","sha":"ad916685fc2fb8581678043efd330a679a0a8f06"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
kibanamachine authored Oct 21, 2024
1 parent 3454617 commit 1fcc6c4
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://github.com/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 1fcc6c4

Please sign in to comment.