# How to disable formatting fields automatically

**URL:** <https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562>\
**Category:** Elasticsearch\
**Created:** [May 21, 2017, 9:59am UTC](https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562 "2017-05-21T09:59:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mendy](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mendy](https://discuss.elastic.co/u/mendy)\
**Post date:** [May 21, 2017, 9:59am UTC](https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562/1 "2017-05-21T09:59:15Z")

</div>

i have many fields in a index. but if i have a new field in an index and the data come in format 'yyyy/MM/dd' the elastic auto map this field as date format but in next value in this field could be text.

i want to disable the auto mapping and set new fields as text type.  
how can i do that?

Regards  
mendy

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 26, 2017, 2:05pm UTC](https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562/2 "2017-05-26T14:05:26Z")

</div>

You can disable dynamic mapping entirely if you want. See the docs here:

[https://www.elastic.co/guide/en/elasticsearch/guide/current/dynamic-mapping.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/dynamic-mapping.html)

If you do that, you'll have to provide an explicit set of mappings before indexing any data. Alternatively, you could leave dynamic mappings enabled but set the mapping for the date field up-front.

Dynamic mappings are only applied to fields that are currently unmapped... so if you provide the correct mapping at the beginning that will be used instead of dynamic mapping

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 30, 2017, 7:50pm UTC](https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562/3 "2017-05-30T19:50:21Z")

</div>

Following up, one of my colleagues suggested a better way which I had forgotten. You can also [disable date detection](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html#_disabling_date_detection) in text fields or specify how detected date should be indexed using [dynamic templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html#match-mapping-type).

---

<div class="post-metadata">

**Author:** ![mendy](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mendy](https://discuss.elastic.co/u/mendy)\
**Post date:** [June 1, 2017, 8:50am UTC](https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562/4 "2017-06-01T08:50:12Z")

</div>

Thank you  
it's very helpful

Regards  
Mendy

---

<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 29, 2017, 8:50am UTC](https://discuss.elastic.co/t/how-to-disable-formatting-fields-automatically/86562/5 "2017-06-29T08:50:50Z")

</div>

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