mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
Docs: Explain closing the high level client
It looks like we weren't clear on when and why you should close the high level client and folks were closing it after every request which is not efficient. This explains why you should close the client and when so this shouldn't be as common. Closes #32001
This commit is contained in:
parent
de2eb85aaf
commit
9822a6f911
1 changed files with 5 additions and 6 deletions
|
@ -130,12 +130,11 @@ include-tagged::{doc-tests}/MiscellaneousDocumentationIT.java[rest-high-level-cl
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
The high-level client will internally create the low-level client used to
|
The high-level client will internally create the low-level client used to
|
||||||
perform requests based on the provided builder, and manage its lifecycle.
|
perform requests based on the provided builder. That low-level client
|
||||||
|
maintains a pool of connections and starts some threads so you should
|
||||||
The high-level client instance needs to be closed when no longer needed so that
|
close the high-level client when you are well and truly done with
|
||||||
all the resources used by it get properly released, as well as the underlying
|
it and it will in turn close the internal low-level client to free those
|
||||||
http client instance and its threads. This can be done through the `close`
|
resources. This can be done through the `close`:
|
||||||
method, which will close the internal `RestClient` instance.
|
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue