Skip to content

Add documentation for closing a client connection #2081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/connecting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This page contains the information you need to connect and use the Client with
* <<client-connect-proxy, Connecting through a proxy>>
* <<client-error-handling, Handling errors>>
* <<keep-alive, Keep-alive connections>>
* <<closing, Closing the client>>
* <<product-check, Automatic product check>>

[[authentication]]
Expand Down Expand Up @@ -691,6 +692,23 @@ const client = new Client({
})
----


[[closing]]
[discrete]
=== Closing the client

If you want to end a connection to an Elasticsearch server, use the `close()` function.

[source,js]
----
const client = new Client({
node: 'http://localhost:9200'
});
// ... do various queries
client.close();
----


[discrete]
[[product-check]]
=== Automatic product check
Expand All @@ -702,3 +720,4 @@ be sent to the server as part of the request pipeline before the main API call i
In most cases, this will succeed during the very first API call that the client sends.
Once the product check completes, no further product check HTTP requests are sent for
subsequent API calls.