-
Notifications
You must be signed in to change notification settings - Fork 275
Description
Java API client version
9.0.4
Java version
21
Elasticsearch Version
9.0.4
Problem description
During migration from ElasticSearch 8.x to 9.x I switched from RestClient to the new Rest5Client.
I was surprised to see that other than before the performRequest method does not throw an exception anymore for ElasticSearch responses with a 4xx status code.
Just as in the old RestClient the Rest5Client performRequest JavaDoc continues to say:
Throws:
IOException – in case of a problem or the connection was aborted
ClientProtocolException – in case of an http protocol error
ResponseException – in case Elasticsearch responded with a status code that indicated an error
But in case of e.g. a Bad Request 400 response from ElasticSearch it now returns a Response return value. In the old RestClient that response caused an IOException and gave a clear signal to my calling code that something went wrong.
I just want to ask if it's now the responsibility of my calling code the check the internal response status code and parse the error details into an exception on its own or if it's really a bug and will be adjusted?
I see that before the convertResponse
method considered statusCode < 300
as an error while now it rather checks statusCode < 500
.
Thanks in advance and rest regards