Create multiple indexes problem

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.

Why are you creating so many indices? Having lots of small indices and shards in Elasticsearch is very inefficient and will lead to performance and stability problems. I would recommend you to reconsider your approach.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.