Client methods can throw two kinds of exceptions:
Requests that were received by the Elasticsearch server but that were rejected
(validation error, server internal timeout exceeded, etc) will produce an
ElasticsearchException. This exception contains details about the error, provided by Elasticsearch.
Requests that failed to reach the server (network error, server unavailable,
etc) will produce a
TransportException. That exception’s cause is the exception thrown by the lower-level implementation. In the case of the
RestClientTransportit will be a
ResponseExceptionthat contains the low level HTTP response.