# Date detection in a dynamic template

**URL:** <https://discuss.elastic.co/t/date-detection-in-a-dynamic-template/7648>\
**Category:** Elasticsearch\
**Created:** [May 11, 2012, 2:26am UTC](https://discuss.elastic.co/t/date-detection-in-a-dynamic-template/7648 "2012-05-11T02:26:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [May 11, 2012, 2:26am UTC](https://discuss.elastic.co/t/date-detection-in-a-dynamic-template/7648/1 "2012-05-11T02:26:39Z")

</div>

Hi guys. In the index linked to below, the dynamic template is configured  
to set its properties' type to "string".

However, when indexing a document that contains a date-like value, the  
dynamic property that's created has its type set to "date" instead of  
"string". Why would that be?

This can be seen on lines 42-45 of the last file in this gist:

> <https://gist.github.com/nickhoffman/a29700e7c13baaa96a05>

Thanks for your help!  
Nick

---

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [May 11, 2012, 2:40am UTC](https://discuss.elastic.co/t/date-detection-in-a-dynamic-template/7648/2 "2012-05-11T02:40:54Z")

</div>

Embarrassingly, I posted too soon. The dynamic property that's created was  
having its type set to "date" instead of "string" because it was NOT  
matching the dynamic template.

After adding a mapping template specifically for dates, life is peachy.

---

<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 6, 2017, 3:29am UTC](https://discuss.elastic.co/t/date-detection-in-a-dynamic-template/7648/3 "2017-07-06T03:29:19Z")

</div>


