elasticsearch-js
                                
                                 elasticsearch-js copied to clipboard
                                
                                    elasticsearch-js copied to clipboard
                            
                            
                            
                        Current documentation on using keepAlive
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?
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.
Ok, so it's enabled by default. It might be good to update the docs to mention that somewhere.