Skip to content

Commit

Permalink
[ES|QL] Update function metadata (elastic#193662)
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 Sep 23, 2024
1 parent 16dcfa8 commit e78ba89
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,42 @@ const atan2Definition: FunctionDefinition = {
examples: ['ROW y=12.9, x=.6\n| EVAL atan2=ATAN2(y, x)'],
};

// Do not edit this manually... generated by scripts/generate_function_definitions.ts
const categorizeDefinition: FunctionDefinition = {
type: 'eval',
name: 'categorize',
description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.categorize', {
defaultMessage: 'Categorizes text messages.',
}),
alias: undefined,
signatures: [
{
params: [
{
name: 'field',
type: 'keyword',
optional: false,
},
],
returnType: 'integer',
},
{
params: [
{
name: 'field',
type: 'text',
optional: false,
},
],
returnType: 'integer',
},
],
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 cbrtDefinition: FunctionDefinition = {
type: 'eval',
Expand Down Expand Up @@ -1256,6 +1292,7 @@ const dateDiffDefinition: FunctionDefinition = {
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)',
'ROW end_23="2023-12-31T23:59:59.999Z"::DATETIME,\n start_24="2024-01-01T00:00:00.000Z"::DATETIME,\n end_24="2024-12-31T23:59:59.999"::DATETIME\n| EVAL end23_to_start24=DATE_DIFF("year", end_23, start_24)\n| EVAL end23_to_end24=DATE_DIFF("year", end_23, end_24)\n| EVAL start_to_end_24=DATE_DIFF("year", start_24, end_24)',
],
};

Expand Down Expand Up @@ -5434,6 +5471,45 @@ const powDefinition: FunctionDefinition = {
],
};

// Do not edit this manually... generated by scripts/generate_function_definitions.ts
const qstrDefinition: FunctionDefinition = {
type: 'eval',
name: 'qstr',
description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.qstr', {
defaultMessage:
'Performs a query string query. Returns true if the provided query string matches the row.',
}),
alias: undefined,
signatures: [
{
params: [
{
name: 'query',
type: 'keyword',
optional: false,
},
],
returnType: 'boolean',
},
{
params: [
{
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 qstr("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 repeatDefinition: FunctionDefinition = {
type: 'eval',
Expand Down Expand Up @@ -8626,6 +8702,7 @@ export const scalarFunctionDefinitions = [
asinDefinition,
atanDefinition,
atan2Definition,
categorizeDefinition,
cbrtDefinition,
ceilDefinition,
cidrMatchDefinition,
Expand Down Expand Up @@ -8672,6 +8749,7 @@ export const scalarFunctionDefinitions = [
nowDefinition,
piDefinition,
powDefinition,
qstrDefinition,
repeatDefinition,
replaceDefinition,
rightDefinition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,35 @@ export const functions = {
),
},
// Do not edit manually... automatically generated by scripts/generate_esql_docs.ts
{
label: i18n.translate('languageDocumentation.documentationESQL.categorize', {
defaultMessage: 'CATEGORIZE',
}),
description: (
<Markdown
openLinksInNewTab
readOnly
enableSoftLineBreaks
markdownContent={i18n.translate(
'languageDocumentation.documentationESQL.categorize.markdown',
{
defaultMessage: `<!--
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-->
### CATEGORIZE
Categorizes text messages.
`,
description:
'Text is in markdown. Do not translate function names, special characters, or field names like sum(bytes)',
ignoreTag: true,
}
)}
/>
),
},
// Do not edit manually... automatically generated by scripts/generate_esql_docs.ts
{
label: i18n.translate('languageDocumentation.documentationESQL.cbrt', {
defaultMessage: 'CBRT',
Expand Down Expand Up @@ -1161,7 +1190,7 @@ export const functions = {
-->
### MV_AVG
Converts a multivalued field into a single valued field containing the average of all of the values.
Converts a multivalued field into a single valued field containing the average of all the values.
\`\`\`
ROW a=[3, 5, 1, 6]
Expand Down Expand Up @@ -1647,7 +1676,7 @@ export const functions = {
-->
### MV_SUM
Converts a multivalued field into a single valued field containing the sum of all of the values.
Converts a multivalued field into a single valued field containing the sum of all the values.
\`\`\`
ROW a=[3, 5, 6]
Expand Down Expand Up @@ -1777,6 +1806,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 e78ba89

Please sign in to comment.