# Can you match an index template based on a doc's field value?

**URL:** <https://discuss.elastic.co/t/can-you-match-an-index-template-based-on-a-docs-field-value/305867>\
**Category:** Elasticsearch\
**Created:** [May 29, 2022, 2:22am UTC](https://discuss.elastic.co/t/can-you-match-an-index-template-based-on-a-docs-field-value/305867 "2022-05-29T02:22:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nama\_Illo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nama_illo/32/45336_2.png) [@Nama\_Illo](https://discuss.elastic.co/u/Nama_Illo)\
**Post date:** [May 29, 2022, 2:22am UTC](https://discuss.elastic.co/t/can-you-match-an-index-template-based-on-a-docs-field-value/305867/1 "2022-05-29T02:22:56Z")

</div>

It appears docs being indexed can hit a specific Index Template based on an "index pattern" that matches a specific naming pattern of an index. I was wondering if there was a way to have a doc hit a specific Index Template based on a field's value from the \_source.

---

<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 29, 2022, 7:58am UTC](https://discuss.elastic.co/t/can-you-match-an-index-template-based-on-a-docs-field-value/305867/2 "2022-05-29T07:58:18Z")

</div>

No, there is not. If that was possible it could cause mapping conflicts, which are not allowed. You can send documents to different indices based on field vslues snd apply different templates that way yhough.

---

<div class="post-metadata">

**Author:** ![Nama\_Illo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nama_illo/32/45336_2.png) [@Nama\_Illo](https://discuss.elastic.co/u/Nama_Illo)\
**Post date:** [May 29, 2022, 3:27pm UTC](https://discuss.elastic.co/t/can-you-match-an-index-template-based-on-a-docs-field-value/305867/3 "2022-05-29T15:27:45Z")

</div>

Thanks so much for the response Christian. That helps explain why I couldn't find a way to do it. I'll make things easier on myself and setup beats locally to collect the different data and send it to the appropriate data steam using its index naming scheme.

I appreciate the help.

---

<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 26, 2022, 3:28pm UTC](https://discuss.elastic.co/t/can-you-match-an-index-template-based-on-a-docs-field-value/305867/4 "2022-06-26T15:28:09Z")

</div>

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