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.
Transport
editTransport
editThis class is responsible to perform the request to Elasticsearch and handling errors, it also handle the sniffing.
const { Client, Transport } = require('@elastic/elasticsearch') class MyTransport extends Transport { request (params, options, callback) { // your code } } const client = new Client({ Transport: MyTransport })
Sometimes you just need to inject a little snippet of your code and then continue to use the usual client code, in such case, you should call super.method
.
class MyTransport extends Transport { request (params, options, callback) { // your code return super.request(params, options, callback) } }