mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
move ignore parameter support from yaml test client to low level rest client (#22637)
All the language clients support a special ignore parameter that doesn't get passed to elasticsearch with the request, but used to indicate which error code should not lead to an exception if returned for a specific request. Moving this to the low level REST client will allow the high level REST client to make use of it too, for instance so that it doesn't have to intercept ResponseExceptions when the get api returns a 404.
This commit is contained in:
parent
eea4db5512
commit
193111919c
5 changed files with 101 additions and 51 deletions
|
@ -206,7 +206,14 @@ access to the returned response.
|
|||
NOTE: A `ResponseException` is **not** thrown for `HEAD` requests that return
|
||||
a `404` status code because it is an expected `HEAD` response that simply
|
||||
denotes that the resource is not found. All other HTTP methods (e.g., `GET`)
|
||||
throw a `ResponseException` for `404` responses.
|
||||
throw a `ResponseException` for `404` responses unless the `ignore` parameter
|
||||
contains `404`. `ignore` is a special client parameter that doesn't get sent
|
||||
to Elasticsearch and contains a comma separated list of error status codes.
|
||||
It allows to control whether some error status code should be treated as an
|
||||
expected response rather than as an exception. This is useful for instance
|
||||
with the get api as it can return `404` when the document is missing, in which
|
||||
case the response body will not contain an error but rather the usual get api
|
||||
response, just without the document as it was not found.
|
||||
|
||||
|
||||
=== Example requests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue