# Same Field name with different mappings

**URL:** <https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797>\
**Category:** Elasticsearch\
**Created:** [March 8, 2016, 3:34pm UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797 "2016-03-08T15:34:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benyamin\_Dvoskin](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@Benyamin\_Dvoskin](https://discuss.elastic.co/u/Benyamin_Dvoskin)\
**Post date:** [March 8, 2016, 3:34pm UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/1 "2016-03-08T15:34:56Z")

</div>

Hi,

we have a system sending documents to ES with several fields having the same name, under different types, using different mappings. all in the same daily logstash index.  
when we were running on 1.x all was working somehow...  
now that we've upgraded to latest (2.2.0), ES rejects those fields from being indexed.

so I understand from documentation that we must have same mapping for fields with identical names.  
assuming we cannot or dont want to do that, is there some way to work around it?

thanks,  
Benjamin

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [March 8, 2016, 5:25pm UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/2 "2016-03-08T17:25:14Z")

</div>

Hi Benjamin. The work-around would be to use different indices for each type of data. While this kind of setup might have seemed to work in 1.x, it was a source of numerous bugs due to the fact thet when querying the whole index, elasticsearch would pick a mapping from a random type and assume it is fine to assume this mapping on all types. It could also cause elasticsearch to run into an unsupported Lucene configuration, like having different type of data (eg. strings and numerics) inder the same field name.

---

<div class="post-metadata">

**Author:** ![Benyamin\_Dvoskin](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@Benyamin\_Dvoskin](https://discuss.elastic.co/u/Benyamin_Dvoskin)\
**Post date:** [March 9, 2016, 7:32am UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/3 "2016-03-09T07:32:21Z")

</div>

thanks for the answer.  
if indeed I use separate indices for each data type, should I expect any difficulties or anything special I need to do to make it work as usual with Kibana?  
or as long as we keep the prefix same (logstash-\*) it should be fine?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 9, 2016, 8:50pm UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/4 "2016-03-09T20:50:26Z")

</div>

> or as long as we keep the prefix same (logstash-\*) it should be fine?

Yes, it should be fine. However, keep in mind that your indexes will be smaller so you may need to adjust the number of shards per index and/or start with weekly or monthly indexes instead of daily.

---

<div class="post-metadata">

**Author:** ![Benyamin\_Dvoskin](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@Benyamin\_Dvoskin](https://discuss.elastic.co/u/Benyamin_Dvoskin)\
**Post date:** [March 10, 2016, 7:53am UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/5 "2016-03-10T07:53:21Z")

</div>

Hi,

thanks for the answer!

what's the rule of thumb for this kind of indices management?  
I mean, currently I have the default shard configuration (so i guess its 5 shards.. with 1 replica).  
what are the reasons to change it to less shards?  
or what would be a good metric to consider for changing to weekly indices?

thanks,

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 10, 2016, 7:59am UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/6 "2016-03-10T07:59:48Z")

</div>

I think the [Designing for Scale chapter](https://www.elastic.co/guide/en/elasticsearch/guide/current/scale.html) of The Definitive Guide will answer most of your questions.

---

<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, 11:09pm UTC](https://discuss.elastic.co/t/same-field-name-with-different-mappings/43797/7 "2017-07-05T23:09:40Z")

</div>


