# Create multiple indexes problem

**URL:** <https://discuss.elastic.co/t/create-multiple-indexes-problem/176326>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [April 11, 2019, 6:13am UTC](https://discuss.elastic.co/t/create-multiple-indexes-problem/176326 "2019-04-11T06:13:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kolitha\_Perera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kolitha_perera/32/43904_2.png) [@Kolitha\_Perera](https://discuss.elastic.co/u/Kolitha_Perera)\
**Post date:** [April 11, 2019, 6:13am UTC](https://discuss.elastic.co/t/create-multiple-indexes-problem/176326/1 "2019-04-11T06:13:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 11, 2019, 7:08am UTC](https://discuss.elastic.co/t/create-multiple-indexes-problem/176326/2 "2019-04-11T07:08:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 14, 2019, 10:48am UTC](https://discuss.elastic.co/t/create-multiple-indexes-problem/176326/4 "2019-05-14T10:48:18Z")

</div>

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