# How to prevent autmatically type conversion in elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-prevent-autmatically-type-conversion-in-elasticsearch/260999>\
**Category:** Elasticsearch\
**Created:** [January 13, 2021, 1:00pm UTC](https://discuss.elastic.co/t/how-to-prevent-autmatically-type-conversion-in-elasticsearch/260999 "2021-01-13T13:00:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vahid\_Alizadeh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vahid_alizadeh/32/77646_2.png) [@Vahid\_Alizadeh](https://discuss.elastic.co/u/Vahid_Alizadeh)\
**Post date:** [January 13, 2021, 1:00pm UTC](https://discuss.elastic.co/t/how-to-prevent-autmatically-type-conversion-in-elasticsearch/260999/1 "2021-01-13T13:00:12Z")

</div>

hi, i use filebeat to send tomcat accesslog to logstash and after that send from logstash to elasticsearch, my data has a field with name logDate, i convert it to string in filebeat and logstash but its type in elasticseach become date. elasticsearch changes this field type depend on first value that sent to elastic for example if the first value before index created be '-' elastic set this field type to string but if the first data be '2020-12-12' set to date.  
my data has different value. how can force elasticsearch to set string type for this field?

---

<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:** [January 13, 2021, 10:12pm UTC](https://discuss.elastic.co/t/how-to-prevent-autmatically-type-conversion-in-elasticsearch/260999/2 "2021-01-13T22:12:04Z")

</div>

Welcome to our community! 😃

You need to use an index template to handle this for you.

---

<div class="post-metadata">

**Author:** ![Vahid\_Alizadeh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vahid_alizadeh/32/77646_2.png) [@Vahid\_Alizadeh](https://discuss.elastic.co/u/Vahid_Alizadeh)\
**Post date:** [January 14, 2021, 7:19am UTC](https://discuss.elastic.co/t/how-to-prevent-autmatically-type-conversion-in-elasticsearch/260999/3 "2021-01-14T07:19:50Z")

</div>

thank you

---

<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:** [February 11, 2021, 7:19am UTC](https://discuss.elastic.co/t/how-to-prevent-autmatically-type-conversion-in-elasticsearch/260999/4 "2021-02-11T07:19:59Z")

</div>

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