# Strange mapping behaviour

**URL:** <https://discuss.elastic.co/t/strange-mapping-behaviour/4364>\
**Category:** Elasticsearch\
**Created:** [May 8, 2011, 6:04pm UTC](https://discuss.elastic.co/t/strange-mapping-behaviour/4364 "2011-05-08T18:04:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [May 8, 2011, 6:04pm UTC](https://discuss.elastic.co/t/strange-mapping-behaviour/4364/1 "2011-05-08T18:04:11Z")

</div>

> <https://gist.github.com/keteracel/961537>

this adds index i1 and i3

index i1 has mappings website and website2

index i3 has mapping website

All mappings have index\_analyzer of ascii\_ngram

Mapping i1:website has a search\_analyzer of ascii\_std  
Mappings i1:website2 and i3:website have a search\_analyzer of ascii\_ngram

So I would expect searches against i1:website2 to return the same values as  
i3:website and that they be different to i1:website. What I actually see is  
that i1:website2 behaves the same as i1:website. It looks like the second  
mapping is not being honored.

[https://gist.github.com/961540](https://gist.github.com/961540) shows the cluster state which shows that the  
mappings appear correct, but the search is not working as exprected. This is  
in version 0.16.0.

Thanks,

## --

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 11, 2011, 7:43pm UTC](https://discuss.elastic.co/t/strange-mapping-behaviour/4364/2 "2011-05-11T19:43:16Z")

</div>

Heya,

First, the definition of the i1/website2 mapping definition is wrong, since you do not specify website2 in the put mapping API (you define website).

Even then, there will be a "collision" for the uri field. And, even though you define teh type when searching, it is not used (this can be a feature enhancement) when choosing an analyzer. The analyzer is chosen based on the first mapping found for the uri field.  
On Sunday, May 8, 2011 at 9:04 PM, Paul Loy wrote:

> [Mappings don't seem to work as expected · GitHub](https://gist.github.com/961537)
> 
> this adds index i1 and i3
> 
> index i1 has mappings website and website2
> 
> index i3 has mapping website
> 
> All mappings have index\_analyzer of ascii\_ngram
> 
> Mapping i1:website has a search\_analyzer of ascii\_std  
> Mappings i1:website2 and i3:website have a search\_analyzer of ascii\_ngram
> 
> So I would expect searches against i1:website2 to return the same values as i3:website and that they be different to i1:website. What I actually see is that i1:website2 behaves the same as i1:website. It looks like the second mapping is not being honored.
> 
> [The indices and mappings · GitHub](https://gist.github.com/961540) shows the cluster state which shows that the mappings appear correct, but the search is not working as exprected. This is in version 0.16.0.
> 
> Thanks,
> 
> ## --
> 
> Paul Loy  
> [paul@keteracel.com](mailto:paul@keteracel.com)  
> [http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<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, 4:06am UTC](https://discuss.elastic.co/t/strange-mapping-behaviour/4364/3 "2017-07-06T04:06:25Z")

</div>

Closed on July 6, 2017, 4:06am UTC


