elasticsearch-js icon indicating copy to clipboard operation
elasticsearch-js copied to clipboard

Current documentation on using keepAlive

Open tao opened this issue 3 years ago • 2 comments

I can't seem to figure out if I should or how I should use keepAlive when creating the Client.

I found lots of bugs and old issues mentioning it, and lots of results for keepAlive when searching in the legacy client (https://github.com/elastic/elasticsearch-js-legacy/search?q=keepAlive). However, I don't see any mention of using it now (or no longer needing to use it in the migration guide) and when I search this repository.

I don't see it being used in the proxy example either but I'm worried about not setting up my cClient correctly without it and overloading my self-hosted ElasticSearch cluster.

Can you provide guidance or improve the documentation on when and how to use keepAlive or if it is no longer necessary to specify it when creating the Client?

tao avatar May 24 '22 10:05 tao

Hello!

You can configure the keep-alive functionality with the agent option. But unless you have a very good reason to disable keep-alive, then don't worry about it. The client will enable it by default and will avoid closing sockets behind the scenes. As result, the overall pressure on your cluster will be lower.

delvedor avatar May 24 '22 13:05 delvedor

Ok, so it's enabled by default. It might be good to update the docs to mention that somewhere.

tao avatar May 24 '22 14:05 tao