# Allowing only fields described in dynamic templates

**URL:** <https://discuss.elastic.co/t/allowing-only-fields-described-in-dynamic-templates/56205>\
**Category:** Elasticsearch\
**Created:** [July 22, 2016, 8:19pm UTC](https://discuss.elastic.co/t/allowing-only-fields-described-in-dynamic-templates/56205 "2016-07-22T20:19:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Danilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_danilov/32/5995_2.png) [@Alexey\_Danilov](https://discuss.elastic.co/u/Alexey_Danilov)\
**Post date:** [July 22, 2016, 8:19pm UTC](https://discuss.elastic.co/t/allowing-only-fields-described-in-dynamic-templates/56205/1 "2016-07-22T20:19:53Z")

</div>

I have dynamic templates describing all the fields in my document. If new field is encountered, I want an exception to be thrown. So far this seems possible only by disabling dynamic mapping, or setting it to strict, and manually specifying mapping for all fields, NOT using dynamic templates. However, I really want to use them, cause they provide required level of flexibility and are generally nicer to write/read than usual mapping - especially for documents containing hundreds of different fields. So is there any way this can be achieved?

---

<div class="post-metadata">

**Author:** ![Alexey\_Danilov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexey_danilov/32/5995_2.png) [@Alexey\_Danilov](https://discuss.elastic.co/u/Alexey_Danilov)\
**Post date:** [July 22, 2016, 8:33pm UTC](https://discuss.elastic.co/t/allowing-only-fields-described-in-dynamic-templates/56205/2 "2016-07-22T20:33:27Z")

</div>

Oh, to answer my own question with a bit of googling around - it seems, it is not currently possible: [https://github.com/elastic/elasticsearch/issues/12358](https://github.com/elastic/elasticsearch/issues/12358)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 24, 2016, 2:17am UTC](https://discuss.elastic.co/t/allowing-only-fields-described-in-dynamic-templates/56205/3 "2016-07-24T02:17:07Z")

</div>

Nah, you can't have "strict" dynamic ☹

---

<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:** [July 5, 2017, 10:33pm UTC](https://discuss.elastic.co/t/allowing-only-fields-described-in-dynamic-templates/56205/4 "2017-07-05T22:33:20Z")

</div>


