forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ES|QL: shorten error messages for UnsupportedAttributes (elastic#111973)
When dealing with index patterns, eg. `FROM logs-*`, some fields can have the same name but different types in different indices. In this case we build an error message like ``` Cannot use field [multi_typed] due to ambiguities being mapped as [2] incompatible types: [ip] in [test1, test2], [keyword] in [test3]" ``` With this PR, in case of many indices involved, we avoid listing them all, but we only list three of them and provide information about how many other indices are affected, eg. ``` Cannot use field [multi_typed] due to ambiguities being mapped as [2] incompatible types: [ip] in [test1, test2, test3] and [2] other indices, [keyword] in [test6] ``` (see the `and [2] other indices`) Since these error messages are stored in `UnspportedAttributes` and serialized, this PR reduces significantly the size of a serialized execution plan with many type conflicts. Fixes elastic#111964 Related to elastic#111358
- Loading branch information
1 parent
ba8590b
commit aa959e6
Showing
4 changed files
with
156 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/51_many_indexes.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
setup: | ||
- requires: | ||
capabilities: | ||
- method: POST | ||
path: /_query | ||
parameters: [method, path, parameters, capabilities] | ||
capabilities: [short_error_messages_for_unsupported_fields] | ||
reason: "We changed error messages for unsupported fields in v 8.16" | ||
test_runner_features: [capabilities, allowed_warnings_regex] | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_1 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: keyword | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_2 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: keyword | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_3 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: keyword | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_4 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: integer | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_5 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: integer | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_6 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: integer | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_7 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: integer | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_8 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: ip | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_9 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: ip | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_10 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: ip | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_11 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: ip | ||
|
||
- do: | ||
indices.create: | ||
index: ambiguous_12 | ||
body: | ||
mappings: | ||
properties: | ||
"name": | ||
type: ip | ||
|
||
--- | ||
load many indices with ambiguities: | ||
- do: | ||
catch: '/Cannot use field \[name\] due to ambiguities being mapped as \[3\] incompatible types: \[integer\] in \[ambiguous_4, ambiguous_5, ambiguous_6\] and \[1\] other index, \[ip\] in \[ambiguous_10, ambiguous_11, ambiguous_12\] and \[2\] other indices, \[keyword\] in \[ambiguous_1, ambiguous_2, ambiguous_3\]/' | ||
esql.query: | ||
body: | ||
query: 'FROM ambiguous* | SORT name' | ||
|