Add a few notes on Cancellable to the LLRC and HLRC docs. (#45912)

Add a section to both the low level and high level client documentation on asynchronous usage and `Cancellable` added for #44802 

Co-Authored-By: Lee Hinman <dakrone@users.noreply.github.com>
This commit is contained in:
Jilles van Gurp 2019-08-28 10:59:33 +02:00 committed by Luca Cavanna
parent 9c6d9a9049
commit e40be722cc
2 changed files with 26 additions and 0 deletions

View file

@ -338,6 +338,12 @@ the underlying http client. On the server side, this does not automatically
translate to the execution of that request being cancelled, which needs to be
specifically implemented in the API itself.
The use of the `Cancellable` instance is optional and you can safely ignore this
if you don't need it. A typical usecase for this would be using this together with
frameworks like Rx Java or the Kotlin's `suspendCancellableCoRoutine`. Cancelling
no longer needed requests is a good way to avoid putting unnecessary
load on Elasticsearch.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/RestClientDocumentation.java[rest-client-async-cancel]