# Create a new index when document has a particular field?

**URL:** <https://discuss.elastic.co/t/create-a-new-index-when-document-has-a-particular-field/333307>\
**Category:** Elasticsearch\
**Created:** [May 12, 2023, 1:04pm UTC](https://discuss.elastic.co/t/create-a-new-index-when-document-has-a-particular-field/333307 "2023-05-12T13:04:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![searchwithme](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchwithme/32/137075_2.png) [@searchwithme](https://discuss.elastic.co/u/searchwithme)\
**Post date:** [May 12, 2023, 1:04pm UTC](https://discuss.elastic.co/t/create-a-new-index-when-document-has-a-particular-field/333307/1 "2023-05-12T13:04:29Z")

</div>

Is it possible to create a new index everytime my document has a particular field updated? say all docs with 'tenant':"100" are part of one index and if a document comes with a field "tenant":101, a new index is created? can this be accomplished with index templates?

---

<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:** [May 12, 2023, 1:06pm UTC](https://discuss.elastic.co/t/create-a-new-index-when-document-has-a-particular-field/333307/2 "2023-05-12T13:06:15Z")

</div>

You should be able to change the index name based on such a field in the data through an ingest pipeline. Whether that is a good idea or not is a different question though. It probably works for smaller number of tenants, but is unlikely to scale well.

---

<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:** [June 9, 2023, 1:06pm UTC](https://discuss.elastic.co/t/create-a-new-index-when-document-has-a-particular-field/333307/3 "2023-06-09T13:06:37Z")

</div>

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