Im using node elasticsearch npm package and I'm creating multiple indexes may be 1000 at once.
my connection string is as follows
this.elasticsearchClient = new elasticsearch.Client({
host: `${config.cache.elasticsearch.host}:${config.cache.elasticsearch.port}`,
requestTimeout: 60000
});
And then I'm looping through an array and call below function to create index on each iteration.
this.elasticsearchClient.index(data, (err, res) => {
if (err) {
reject(err);
} else {
resolve(res);
}
});
this process is very slow and it gives below error if the indexes count is more than around 50.
[process_cluster_event_timeout_exception] failed to process cluster event (put-mapping) within 30s
and request timout too.
I'm new to elasticsearch and please help me to get through with this.