diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java index bad5ca106..869419249 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java @@ -40,7 +40,7 @@ public class ElasticsearchException extends RuntimeException { public ElasticsearchException(String endpointId, ErrorResponse response, @Nullable TransportHttpClient.Response httpResponse) { - super("[" + endpointId + "] failed: [" + response.error().type() + "] " + response.error().reason()); + super("[" + endpointId + "] failed: [" + response.error().type() + "] " + response.error().reason() + (response.error().causedBy() != null ? " - " + response.error().causedBy().reason() : null)); this.response = response; this.endpointId = endpointId; this.httpResponse = httpResponse;