# Preference in index mapping

**URL:** <https://discuss.elastic.co/t/preference-in-index-mapping/115356>\
**Category:** Elasticsearch\
**Created:** [January 12, 2018, 7:50pm UTC](https://discuss.elastic.co/t/preference-in-index-mapping/115356 "2018-01-12T19:50:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fhalde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fhalde/32/21419_2.png) [@fhalde](https://discuss.elastic.co/u/fhalde)\
**Post date:** [January 12, 2018, 7:50pm UTC](https://discuss.elastic.co/t/preference-in-index-mapping/115356/1 "2018-01-12T19:50:03Z")

</div>

If I'm leveraging dynamic template and let's say I have specified a field say abcd to be of type long and in the dynamic template i specify for any field pattern matching ab\*, the type should be string, what will ES infer the type as?

---

<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 15, 2018, 5:46am UTC](https://discuss.elastic.co/t/preference-in-index-mapping/115356/2 "2018-01-15T05:46:10Z")

</div>

More precise definitions will take precedence over things like (wide) wildcards.

So `"abcd": long` takes precedence over `"abc"*: long`.  
`"abc*": long` takes precedence over `"ab*": long`.

---

<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 12, 2018, 5:46am UTC](https://discuss.elastic.co/t/preference-in-index-mapping/115356/3 "2018-02-12T05:46:12Z")

</div>

Closed on February 12, 2018, 5:46am UTC

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