-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail shards early when we can detect a type missmatch #79869
Changes from 10 commits
47119d8
7e374a3
887bdc1
64d82ea
4a0d8e6
77d621d
af886a1
04fcb13
179fcbe
3739806
08f61ac
345b24a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1368,3 +1368,67 @@ huge size: | |
- match: { aggregations.str_terms.buckets.1.doc_count: 2 } | ||
- match: { aggregations.str_terms.buckets.2.key: c } | ||
- match: { aggregations.str_terms.buckets.2.doc_count: 3 } | ||
|
||
--- | ||
Value type missmatch fails shard: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: "Fixed in 8.1" | ||
|
||
- do: | ||
indices.create: | ||
index: valuetype_test_1 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
ip: | ||
type: keyword | ||
- do: | ||
indices.create: | ||
index: valuetype_test_2 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
ip: | ||
type: ip | ||
|
||
- do: | ||
bulk: | ||
index: valuetype_test_2 | ||
refresh: true | ||
body: | | ||
{ "index": {} } | ||
{ "ip": "127.0.0.1" } | ||
{ "index": {} } | ||
{ "ip": "192.168.0.1" } | ||
{ "index": {} } | ||
{ "ip": "192.168.0.2" } | ||
{ "index": {} } | ||
{ "ip": "192.168.0.3" } | ||
- do: | ||
search: | ||
index: valuetype_test_1,valuetype_test_2 | ||
body: | ||
size: 0 | ||
aggs: | ||
str_terms: | ||
terms: | ||
field: ip | ||
value_type: ip | ||
|
||
- match: { _shards.failed: 1 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a special case of the problem, because Also, would it make sense to add a test where the index may contain documents? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, there are two problems with silently skipping shards that don't have docs that I can think of. First, we don't know that until later in the process, and by that time we don't have an obvious way to check if we have a conflict. So we'd need to carry some "has type conflict" flag and fail if that's true and we have docs. Seems clunky. It also adds some leniency and unpredictability. If the query changes to include docs on those shards, now the aggregation starts failing. Seems confusing. Furthermore, if there are no matching docs on the shard, failing it doesn't change the results. It just lets the user know there's a potential problem. More information is better. And, finally, yes, it makes sense to add a test with docs in both indices. Will push one up shortly. Thanks! |
||
- length: { aggregations.str_terms.buckets: 4 } | ||
- match: { aggregations.str_terms.buckets.0.key: "127.0.0.1" } | ||
- match: { aggregations.str_terms.buckets.0.doc_count: 1 } | ||
- match: { aggregations.str_terms.buckets.1.key: "192.168.0.1" } | ||
- match: { aggregations.str_terms.buckets.1.doc_count: 1 } | ||
- match: { aggregations.str_terms.buckets.2.key: "192.168.0.2" } | ||
- match: { aggregations.str_terms.buckets.2.doc_count: 1 } | ||
- match: { aggregations.str_terms.buckets.3.key: "192.168.0.3" } | ||
- match: { aggregations.str_terms.buckets.3.doc_count: 1 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: mismatch (not missmatch)