Skip to content

Commit d416490

Browse files
committed
asciidocs
1 parent d93cd29 commit d416490

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/release-notes/release-highlights.asciidoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@ For a list of detailed changes, including bug fixes, please see the https://gith
88
[discrete]
99
==== Version 8.16
1010
* `ElasticsearchClient` is now `Closeable`. Closing a client object also closes the underlying transport - https://github.com/elastic/elasticsearch-java/pull/851[#851]
11+
* Added option to make the response body available in case of deserialization error- https://github.com/elastic/elasticsearch-java/pull/886[#886].
12+
13+
** While it has always been possible to set the log level to `trace` and have the client print both the json bodies of the requests and responses, it's often not the best solution because of the large amount of information printed.
14+
** To enable the feature:
15+
16+
RestClientOptions options = new RestClientOptions(RequestOptions.DEFAULT, true);
17+
ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper(), options);
18+
ElasticsearchClient esClientWithOptions = new ElasticsearchClient(transport);
19+
20+
** To retrieve the original body from the TransportException that gets thrown in case of deserialization errors:
21+
22+
try{
23+
// some code that returns faulty json
24+
}
25+
catch (TransportException ex){
26+
try (RepeatableBodyResponse repeatableResponse = (RepeatableBodyResponse) ex.response()) {
27+
BinaryData body = repeatableResponse.body();
28+
}
29+
}
30+
1131

1232
[discrete]
1333
==== Version 8.15

0 commit comments

Comments
 (0)