# Dynamic template causing "Mixing up field types" error only for certain fields names!

**URL:** <https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661>\
**Category:** Elasticsearch\
**Created:** [August 10, 2016, 6:52am UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661 "2016-08-10T06:52:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Somnath\_Pal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somnath_pal/32/11420_2.png) [@Somnath\_Pal](https://discuss.elastic.co/u/Somnath_Pal)\
**Post date:** [August 10, 2016, 6:52am UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661/1 "2016-08-10T06:52:01Z")

</div>

On Es 2.3.3 cluster (3 node) I have following mapping on a index, please note dynamic mapping for timestamp field (field names ending with \_ts)  
{  
"logs-pc-2016-08-09": {  
"mappings": {  
"rs": {  
"\_all": {  
"enabled": false  
},  
"dynamic\_templates": [  
{  
"integers": {  
"mapping": {  
"type": "integer"  
},  
"match\_mapping\_type": "long"  
}  
},  
{  
"ts": {  
"mapping": {  
"format": "epoch\_millis",  
"type": "date"  
},  
"match": "_\_ts",  
"match\_mapping\_type": "string"  
}  
},  
{  
"strings\_notanalyzed": {  
"mapping": {  
"index": "not\_analyzed",  
"type": "string"  
},  
"match\_mapping\_type": "string",  
"unmatch": "_\_analyzed"  
}  
}  
],  
"properties": {  
...  
"orig\_timestamp": {  
"type": "date",  
"format": "strict\_date\_optional\_time||epoch\_millis"  
},  
"pid": {  
"type": "string"  
},  
"product": {  
"type": "string"  
},  
"project\_id": {  
"type": "string"  
},  
"server\_ts": {  
"type": "date",  
"format": "strict\_date\_optional\_time||epoch\_millis"  
},  
"servicename": {  
"type": "string"  
},  
"servicetype": {  
"type": "string"  
},  
"severity": {  
"type": "string"  
},  
"threadid": {  
"type": "string"  
},  
"timestamp": {  
"type": "date",  
"format": "strict\_date\_optional\_time||epoch\_millis"  
},  
"timezone": {  
"type": "string"  
},  
"upload\_ts": {  
"type": "date",  
"format": "epoch\_millis"  
},  
"uploadxyz\_ts": {  
"type": "date",  
"format": "epoch\_millis"  
},  
"user\_id": {  
"type": "string"  
},  
"wfid": {  
"type": "string"  
}  
}  
}  
}  
}  
}

Note, **uploaded\_ts** is not part of the already created mapping.  
I tried inserting a new doc with uploaded\_ts field

POST logs-pc-2016-08-09/rs  
{  
"server\_ts": "1470805090135",  
"msgcode": "REP\_51025",  
"nodename": "N\_01861193",  
"uploaded\_ts": "1470805088738"  
}

I get this error

_Mixing up field types: class org.elasticsearch.index.mapper.core.DateFieldMapper$DateFieldType != class org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType on field_

Surprisingly,If I change the uploaded\_ts to upload **xyz** \_ts it works!  
Now I have absolutely no clue whats happening.

---

<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:** [August 10, 2016, 9:12pm UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661/2 "2016-08-10T21:12:08Z")

</div>

Can you update that post and use the `</>` button to properly encode the mapping, it's really hard to read as it is.

---

<div class="post-metadata">

**Author:** ![Somnath\_Pal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somnath_pal/32/11420_2.png) [@Somnath\_Pal](https://discuss.elastic.co/u/Somnath_Pal)\
**Post date:** [August 11, 2016, 9:11am UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661/4 "2016-08-11T09:11:32Z")

</div>

Sorry I tried but didn't work, trying to upload it as image

 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/a307d8fec63c356461f3e08f2752b6c19f781238.png)

---

<div class="post-metadata">

**Author:** ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)\
**Post date:** [August 11, 2016, 10:03am UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661/5 "2016-08-11T10:03:12Z")

</div>

line feed before the code ,so that you can use \</\>

just like :  
word

code

---

<div class="post-metadata">

**Author:** ![Somnath\_Pal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somnath_pal/32/11420_2.png) [@Somnath\_Pal](https://discuss.elastic.co/u/Somnath_Pal)\
**Post date:** [August 17, 2016, 5:17am UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661/6 "2016-08-17T05:17:28Z")

</div>

I hope the picture attached in my previous reply is okay

---

<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:27pm UTC](https://discuss.elastic.co/t/dynamic-template-causing-mixing-up-field-types-error-only-for-certain-fields-names/57661/7 "2017-07-05T22:27:26Z")

</div>


