# Multi\_field mapping not working correctly? Restrictions?

**URL:** <https://discuss.elastic.co/t/multi-field-mapping-not-working-correctly-restrictions/8872>\
**Category:** Elasticsearch\
**Created:** [August 28, 2012, 2:42pm UTC](https://discuss.elastic.co/t/multi-field-mapping-not-working-correctly-restrictions/8872 "2012-08-28T14:42:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [August 28, 2012, 2:42pm UTC](https://discuss.elastic.co/t/multi-field-mapping-not-working-correctly-restrictions/8872/1 "2012-08-28T14:42:45Z")

</div>

Hi guys,

I'm trying to use a facet over a field and I'm making use of "multi\_field"  
in order to have a "keyword" analyzer over it.

Now for some strange reason it only works if I assign it to the field  
called "name" not the field called "nameFacet", I guess a gist is worth  
thousands of words

This [https://gist.github.com/3498390](https://gist.github.com/3498390) is the non-working version, note that  
the mapping is over a field called "name" and it has two fields "name"  
again and "nameFacet" which is the one that I assigned the keyword  
analyzer, and is the one that I'm planning to use for faceted search.

And this one [https://gist.github.com/3498562](https://gist.github.com/3498562) that is exactly the same but  
with the keyword analyzer over "name" instead of "nameFacet"

What is that that I'm doing wrong?

Is there any kind of restriction over on how I should call the field on my  
objects?

Cheers

~M

--

---

<div class="post-metadata">

**Author:** ![Keith\_Webster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keith_webster/32/1532_2.png) [@Keith\_Webster](https://discuss.elastic.co/u/Keith_Webster)\
**Post date:** [August 28, 2012, 4:23pm UTC](https://discuss.elastic.co/t/multi-field-mapping-not-working-correctly-restrictions/8872/2 "2012-08-28T16:23:23Z")

</div>

Hey Maverick,

The reason you are experiencing this issue is because you are referring to  
the facet as employmentHistory.nameFacet instead of using the full path of  
employmentHistory.name.nameFacet. This of course is not an issue when  
referring to name itself since it's actually the same name as it's "parent"  
so it's inferred from that.

Also just as a side note: You are probably better of just setting index  
to not\_analyzed and removing the keyword analyzer as this will leave the  
field untouched for the facet. It's not a huge deal but it's shorter and  
makes the intent more obvious.

On Tuesday, 28 August 2012 09:42:45 UTC-5, maverick wrote:

> Hi guys,
> 
> I'm trying to use a facet over a field and I'm making use of "multi\_field"  
> in order to have a "keyword" analyzer over it.
> 
> Now for some strange reason it only works if I assign it to the field  
> called "name" not the field called "nameFacet", I guess a gist is worth  
> thousands of words
> 
> This [facet test over employmentHistory · GitHub](https://gist.github.com/3498390) is the non-working version, note  
> that the mapping is over a field called "name" and it has two fields "name"  
> again and "nameFacet" which is the one that I assigned the keyword  
> analyzer, and is the one that I'm planning to use for faceted search.
> 
> And this one [working version of multi\_field facet · GitHub](https://gist.github.com/3498562) that is exactly the same but  
> with the keyword analyzer over "name" instead of "nameFacet"
> 
> What is that that I'm doing wrong?
> 
> Is there any kind of restriction over on how I should call the field on my  
> objects?
> 
> Cheers
> 
> ~M

--

---

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [August 28, 2012, 5:42pm UTC](https://discuss.elastic.co/t/multi-field-mapping-not-working-correctly-restrictions/8872/3 "2012-08-28T17:42:38Z")

</div>

Thank you very much clatog.

That was indeed my mistake, I own you beer mate

cheers

On Tuesday, August 28, 2012 12:23:23 PM UTC-4, ciatog wrote:

> Hey Maverick,
> 
> The reason you are experiencing this issue is because you are referring to  
> the facet as employmentHistory.nameFacet instead of using the full path of  
> employmentHistory.name.nameFacet. This of course is not an issue when  
> referring to name itself since it's actually the same name as it's "parent"  
> so it's inferred from that.
> 
> Also just as a side note: You are probably better of just setting index  
> to not\_analyzed and removing the keyword analyzer as this will leave the  
> field untouched for the facet. It's not a huge deal but it's shorter and  
> makes the intent more obvious.
> 
> On Tuesday, 28 August 2012 09:42:45 UTC-5, maverick wrote:
> 
> > Hi guys,
> > 
> > I'm trying to use a facet over a field and I'm making use of  
> > "multi\_field" in order to have a "keyword" analyzer over it.
> > 
> > Now for some strange reason it only works if I assign it to the field  
> > called "name" not the field called "nameFacet", I guess a gist is worth  
> > thousands of words
> > 
> > This [facet test over employmentHistory · GitHub](https://gist.github.com/3498390) is the non-working version, note  
> > that the mapping is over a field called "name" and it has two fields "name"  
> > again and "nameFacet" which is the one that I assigned the keyword  
> > analyzer, and is the one that I'm planning to use for faceted search.
> > 
> > And this one [working version of multi\_field facet · GitHub](https://gist.github.com/3498562) that is exactly the same  
> > but with the keyword analyzer over "name" instead of "nameFacet"
> > 
> > What is that that I'm doing wrong?
> > 
> > Is there any kind of restriction over on how I should call the field on  
> > my objects?
> > 
> > Cheers
> > 
> > ~M

--

---

<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:14am UTC](https://discuss.elastic.co/t/multi-field-mapping-not-working-correctly-restrictions/8872/4 "2017-07-06T03:14:48Z")

</div>


