Increasing default 30 seconds timeout in Elasticsearch client for NodeJS
The default timeout for Elasticsearch client for NodeJs is 30 seconds. So if a query takes more than 30 seconds that will error out and you need to increase it to work.
Following code shows how to increase it to a minute from default 30 seconds.
const elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
requestTimeout: 60000,
host: 'localhost'
});