Propagate index errors in field_caps (#70245)

Currently we don't report any exceptions occuring during field_caps requests back to the user.
This PR adds a new failure section to the response which contains exceptions per index. 
In addition the response contains another field, `failed_indices`, with the number of indices that threw
an exception. If all of the requested indices fail, the whole request fails, otherwise the request succeeds 
and it is up to the caller to check for potential errors in the response body.

Closes #68994
This commit is contained in:
Christoph Büscher 2021-04-06 12:02:24 +02:00 committed by GitHub
parent a07d876a93
commit a413ae67e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 631 additions and 79 deletions

View file

@ -61,10 +61,13 @@
- is_false: fields.geo.keyword.on_aggregatable_indices
- do:
catch: missing
field_caps:
index: 'my_remote_cluster:some_index_that_doesnt_exist'
fields: [number]
- match: { 'fields': {} } # empty response - this index doesn't exists
- match: { error.type: "index_not_found_exception" }
- match: { error.reason: "no such index [some_index_that_doesnt_exist]" }
- do:
field_caps:
@ -86,6 +89,23 @@
- match: {fields.number.keyword.aggregatable: true}
- match: {fields.number.keyword.type: keyword}
- do:
catch: bad_request
field_caps:
index: 'my_remote_cluster:field_caps_index_1'
fields: [number]
body:
runtime_mappings:
day_of_week:
type: keyword
script:
source: "bad syntax"
- match: { error.type: "script_exception" }
- match: { error.reason: "compile error" }
- match: { error.script : "bad syntax" }
- match: { error.lang : "painless" }
---
"Get field caps from remote cluster with index filter":
- skip: