Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,27 @@ describe('autocomplete.suggest', () => {
test('when typing inside function left paren', async () => {
const { assertSuggestions } = await setup();
const expected = [
...getFieldNamesByType([...ESQL_COMMON_NUMERIC_TYPES, 'date', 'boolean', 'ip']),
...getFieldNamesByType([
...ESQL_COMMON_NUMERIC_TYPES,
'date',
'boolean',
'ip',
'version',
'text',
'keyword',
]),
...getFunctionSignaturesByReturnType(
'stats',
[...ESQL_COMMON_NUMERIC_TYPES, 'date', 'date_period', 'boolean', 'ip'],
[
...ESQL_COMMON_NUMERIC_TYPES,
'date',
'date_period',
'boolean',
'ip',
'version',
'text',
'keyword',
],
{
scalar: true,
}
Expand Down
24 changes: 24 additions & 0 deletions packages/kbn-esql-validation-autocomplete/src/definitions/aggs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,18 @@ export const statsAggregationFunctionDefinitions: FunctionDefinition[] = [
params: [{ name: 'column', type: 'ip', noNestingFunctions: true }],
returnType: 'ip',
},
{
params: [{ name: 'column', type: 'version', noNestingFunctions: true }],
returnType: 'version',
},
{
params: [{ name: 'column', type: 'keyword', noNestingFunctions: true }],
returnType: 'keyword',
},
{
params: [{ name: 'column', type: 'text', noNestingFunctions: true }],
returnType: 'text',
},
],
examples: [`from index | stats result = max(field)`, `from index | stats max(field)`],
},
Expand Down Expand Up @@ -186,6 +198,18 @@ export const statsAggregationFunctionDefinitions: FunctionDefinition[] = [
params: [{ name: 'column', type: 'ip', noNestingFunctions: true }],
returnType: 'ip',
},
{
params: [{ name: 'column', type: 'version', noNestingFunctions: true }],
returnType: 'version',
},
{
params: [{ name: 'column', type: 'keyword', noNestingFunctions: true }],
returnType: 'keyword',
},
{
params: [{ name: 'column', type: 'text', noNestingFunctions: true }],
returnType: 'text',
},
],
examples: [`from index | stats result = min(field)`, `from index | stats min(field)`],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31860,23 +31860,17 @@
},
{
"query": "from a_index | stats max(concat(\"20\", \"22\"))",
"error": [
"Argument of [max] must be [double], found value [concat(\"20\",\"22\")] type [keyword]"
],
"error": [],
"warning": []
},
{
"query": "from a_index | stats var = max(textField)",
"error": [
"Argument of [max] must be [double], found value [textField] type [text]"
],
"error": [],
"warning": []
},
{
"query": "from a_index | stats max(textField)",
"error": [
"Argument of [max] must be [double], found value [textField] type [text]"
],
"error": [],
"warning": []
},
{
Expand Down Expand Up @@ -31921,6 +31915,110 @@
],
"warning": []
},
{
"query": "from a_index | stats var = max(versionField)",
"error": [],
"warning": []
},
{
"query": "from a_index | stats max(versionField)",
"error": [],
"warning": []
},
{
"query": "from a_index | stats var = max(keywordField)",
"error": [],
"warning": []
},
{
"query": "from a_index | stats max(keywordField)",
"error": [],
"warning": []
},
{
"query": "from a_index | where max(versionField)",
"error": [
"WHERE does not support function max"
],
"warning": []
},
{
"query": "from a_index | where max(versionField) > 0",
"error": [
"WHERE does not support function max"
],
"warning": []
},
{
"query": "from a_index | where max(keywordField)",
"error": [
"WHERE does not support function max"
],
"warning": []
},
{
"query": "from a_index | where max(keywordField) > 0",
"error": [
"WHERE does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval var = max(versionField)",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval var = max(versionField) > 0",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval max(versionField)",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval max(versionField) > 0",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval var = max(keywordField)",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval var = max(keywordField) > 0",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval max(keywordField)",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | eval max(keywordField) > 0",
"error": [
"EVAL does not support function max"
],
"warning": []
},
{
"query": "from a_index | stats var = min(doubleField)",
"error": [],
Expand Down Expand Up @@ -32500,23 +32598,17 @@
},
{
"query": "from a_index | stats min(concat(\"20\", \"22\"))",
"error": [
"Argument of [min] must be [double], found value [concat(\"20\",\"22\")] type [keyword]"
],
"error": [],
"warning": []
},
{
"query": "from a_index | stats var = min(textField)",
"error": [
"Argument of [min] must be [double], found value [textField] type [text]"
],
"error": [],
"warning": []
},
{
"query": "from a_index | stats min(textField)",
"error": [
"Argument of [min] must be [double], found value [textField] type [text]"
],
"error": [],
"warning": []
},
{
Expand Down Expand Up @@ -32561,6 +32653,110 @@
],
"warning": []
},
{
"query": "from a_index | stats var = min(versionField)",
"error": [],
"warning": []
},
{
"query": "from a_index | stats min(versionField)",
"error": [],
"warning": []
},
{
"query": "from a_index | stats var = min(keywordField)",
"error": [],
"warning": []
},
{
"query": "from a_index | stats min(keywordField)",
"error": [],
"warning": []
},
{
"query": "from a_index | where min(versionField)",
"error": [
"WHERE does not support function min"
],
"warning": []
},
{
"query": "from a_index | where min(versionField) > 0",
"error": [
"WHERE does not support function min"
],
"warning": []
},
{
"query": "from a_index | where min(keywordField)",
"error": [
"WHERE does not support function min"
],
"warning": []
},
{
"query": "from a_index | where min(keywordField) > 0",
"error": [
"WHERE does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval var = min(versionField)",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval var = min(versionField) > 0",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval min(versionField)",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval min(versionField) > 0",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval var = min(keywordField)",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval var = min(keywordField) > 0",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval min(keywordField)",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | eval min(keywordField) > 0",
"error": [
"EVAL does not support function min"
],
"warning": []
},
{
"query": "from a_index | stats var = count(textField)",
"error": [],
Expand Down
Loading