# Using "dynamic" : "strict" to prevent unintended fields from being created?

**URL:** <https://discuss.elastic.co/t/using-dynamic-strict-to-prevent-unintended-fields-from-being-created/35919>\
**Category:** Elasticsearch\
**Created:** [November 30, 2015, 3:24pm UTC](https://discuss.elastic.co/t/using-dynamic-strict-to-prevent-unintended-fields-from-being-created/35919 "2015-11-30T15:24:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeeSyd](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@LeeSyd](https://discuss.elastic.co/u/LeeSyd)\
**Post date:** [November 30, 2015, 3:24pm UTC](https://discuss.elastic.co/t/using-dynamic-strict-to-prevent-unintended-fields-from-being-created/35919/1 "2015-11-30T15:24:24Z")

</div>

I've taken on an environment and am getting up to speed on the ELK stack. In some of my old indices are a lot of randomly named fields where a URI or some HTTP content has been passed in and not correctly parsed into fields.

I've created a new EL2.1 cluster and would like to prevent this in future. I've tried setting "dynamic" : "strict" and explicity defined the fields and mappings I want to see within a template but it appears that when passing info over from Logstash, when it attempts to create additional field and hits this setting, the document is not loaded into EL.

Can anybody advise if there is a way that I can get documents to load all permitted fields and ignore those not defined?

Thanks

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [November 30, 2015, 5:37pm UTC](https://discuss.elastic.co/t/using-dynamic-strict-to-prevent-unintended-fields-from-being-created/35919/2 "2015-11-30T17:37:13Z")

</div>

Maybe `dynamic: false` is what you are looking for? It will ignore all fields that are not defined in the mappings (but they will still remain accessible via the `_source`).

---

<div class="post-metadata">

**Author:** ![LeeSyd](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@LeeSyd](https://discuss.elastic.co/u/LeeSyd)\
**Post date:** [December 3, 2015, 10:10am UTC](https://discuss.elastic.co/t/using-dynamic-strict-to-prevent-unintended-fields-from-being-created/35919/3 "2015-12-03T10:10:50Z")

</div>

Perfect - thank you. I had searched the current version documentation and not found detail on the options available but have tried this and it works as required. Have subsequently found more detail in "Elasticsearch: The Definitive Guide".

Thanks

---

<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, 11:33pm UTC](https://discuss.elastic.co/t/using-dynamic-strict-to-prevent-unintended-fields-from-being-created/35919/4 "2017-07-05T23:33:55Z")

</div>


