# Create a new indices for each random directory

**URL:** <https://discuss.elastic.co/t/create-a-new-indices-for-each-random-directory/357329>\
**Category:** Logstash\
**Tags:** reindex\
**Created:** [April 13, 2024, 5:05am UTC](https://discuss.elastic.co/t/create-a-new-indices-for-each-random-directory/357329 "2024-04-13T05:05:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 13, 2024, 5:37am UTC](https://discuss.elastic.co/t/create-a-new-indices-for-each-random-directory/357329/2 "2024-04-13T05:37:54Z")

</div>

> [@Sandeep\_Baljepally](#):
>
> How can I create seperate indices for each random directory?

That's simple enough. Parse [log][file][path] using grok to extract the directory name (e.g. see [this](https://discuss.elastic.co/t/is-it-possible-to-create-multiple-index-with-multiple-folder-name/321457/2) thread).

However, creating an index per day per directory can be a performance issue in elasticsearch because it can create a large number of small indexes/shards. (An index is stored in one or more shards.)

The [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/size-your-shards.html) recommends using multi-gigabyte shards.

---

_[View the full topic](https://discuss.elastic.co/t/create-a-new-indices-for-each-random-directory/357329)._
