WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Connection
editConnection
editThis class represents a single Node, it holds every information we have on the node, such as roles, id, URL, custom headers and so on. The actual HTTP request is performed here, this means that if you want to swap the default HTTP client (Node.js core), you should override this class request
method.
const { Client, Connection } = require('@elastic/elasticsearch') class MyConnection extends Connection { request (params, callback) { // your code } } const client = new Client({ Connection: MyConnection })