ConnectionPooledit

This class is responsible for keeping in memory all the Elasticsearch Connection that we are using, there is a single Connection for every node.
Moreover, the connection pool will handle the resurrection strategies and the updates of the pool.

const { Client, ConnectionPool } = require('@elastic/elasticsearch')

class MyConnectionPool extends ConnectionPool {
  markAlive (connection) {
    // your code
    super.markAlive(connection)
  }
}

const client = new Client({
    ConnectionPool: MyConnectionPool
})