# Inner/nested object term facet question (gisted)

**URL:** <https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792>\
**Category:** Elasticsearch\
**Created:** [August 20, 2012, 9:12pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792 "2012-08-20T21:12:31Z")\
**Posts on this page:** 7\
**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 20, 2012, 9:12pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/1 "2012-08-20T21:12:31Z")

</div>

Hi guys

I'm trying to do a term facet query over a nested object but I haven't been  
able to make it work. I was wondering if someone can give me some insights  
on my mistake?

I've gisted here [https://gist.github.com/3407734](https://gist.github.com/3407734) but I always got zero term  
facets. I've done other facets many times but seems that there's a trick on  
this one.

Thanks

--

---

<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 22, 2012, 1:19pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/2 "2012-08-22T13:19:40Z")

</div>

Bump!.. nobody? c'mon guys

On Monday, August 20, 2012 5:12:31 PM UTC-4, maverick wrote:

> Hi guys
> 
> I'm trying to do a term facet query over a nested object but I haven't  
> been able to make it work. I was wondering if someone can give me some  
> insights on my mistake?
> 
> I've gisted here [https://gist.github.com/3407734](https://gist.github.com/3407734) but I always got zero  
> term facets. I've done other facets many times but seems that there's a  
> trick on this one.
> 
> Thanks

--

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [August 22, 2012, 1:48pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/3 "2012-08-22T13:48:04Z")

</div>

There is not a single feed with data in the field -

educationHistory.nameFacet

Thanks  
Vineeth

On Wed, Aug 22, 2012 at 6:49 PM, maverick [mauricio.alarcon@gmail.com](mailto:mauricio.alarcon@gmail.com)wrote:

> Bump!.. nobody? c'mon guys
> 
> On Monday, August 20, 2012 5:12:31 PM UTC-4, maverick wrote:
> 
> > Hi guys
> > 
> > I'm trying to do a term facet query over a nested object but I haven't  
> > been able to make it work. I was wondering if someone can give me some  
> > insights on my mistake?
> > 
> > I've gisted here [https://gist.github.com/\*\*3407734](https://gist.github.com/**3407734)[https://gist.github.com/3407734](https://gist.github.com/3407734) but  
> > I always got zero term facets. I've done other facets many times but seems  
> > that there's a trick on this one.
> > 
> > Thanks
> > 
> > --

--

---

<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 22, 2012, 3:01pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/4 "2012-08-22T15:01:38Z")

</div>

Thanks Vineeth,

actually there is one, check the mapping, is a multi\_field one of them is  
"name" the other is "nameFacet" that is analyzed with "keyword" analyzer..

In any case, not even the educationHistory.name works

Any other ideas?

On Wednesday, August 22, 2012 9:48:04 AM UTC-4, Vineeth Mohan wrote:

> There is not a single feed with data in the field -
> 
> educationHistory.nameFacet
> 
> Thanks  
> Vineeth
> 
> On Wed, Aug 22, 2012 at 6:49 PM, maverick \<[mauricio...@gmail.com](mailto:mauricio...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Bump!.. nobody? c'mon guys
> > 
> > On Monday, August 20, 2012 5:12:31 PM UTC-4, maverick wrote:
> > 
> > > Hi guys
> > > 
> > > I'm trying to do a term facet query over a nested object but I haven't  
> > > been able to make it work. I was wondering if someone can give me some  
> > > insights on my mistake?
> > > 
> > > I've gisted here [https://gist.github.com/\*\*3407734](https://gist.github.com/**3407734)[https://gist.github.com/3407734](https://gist.github.com/3407734) but  
> > > I always got zero term facets. I've done other facets many times but seems  
> > > that there's a trick on this one.
> > > 
> > > Thanks
> > > 
> > > --

--

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [August 22, 2012, 5:51pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/5 "2012-08-22T17:51:42Z")

</div>

Your mapping is incorrect. The first field in the JSON mapping refers  
to the type (which is redundant given the URL, but that's how it is).

Take a look at the PUT mapping example:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Also, your mapping redefines employmentHistory but the facet is on  
educationHistory.

Cheers,

Ivan

On Wed, Aug 22, 2012 at 8:01 AM, maverick [mauricio.alarcon@gmail.com](mailto:mauricio.alarcon@gmail.com) wrote:

> Thanks Vineeth,
> 
> actually there is one, check the mapping, is a multi\_field one of them is  
> "name" the other is "nameFacet" that is analyzed with "keyword" analyzer..
> 
> In any case, not even the educationHistory.name works
> 
> Any other ideas?
> 
> On Wednesday, August 22, 2012 9:48:04 AM UTC-4, Vineeth Mohan wrote:
> 
> > There is not a single feed with data in the field -
> > 
> > educationHistory.nameFacet
> > 
> > Thanks  
> > Vineeth
> > 
> > On Wed, Aug 22, 2012 at 6:49 PM, maverick [mauricio...@gmail.com](mailto:mauricio...@gmail.com) wrote:
> > 
> > > Bump!.. nobody? c'mon guys
> > > 
> > > On Monday, August 20, 2012 5:12:31 PM UTC-4, maverick wrote:
> > > 
> > > > Hi guys
> > > > 
> > > > I'm trying to do a term facet query over a nested object but I haven't  
> > > > been able to make it work. I was wondering if someone can give me some  
> > > > insights on my mistake?
> > > > 
> > > > I've gisted here [https://gist.github.com/3407734](https://gist.github.com/3407734) but I always got zero  
> > > > term facets. I've done other facets many times but seems that there's a  
> > > > trick on this one.
> > > > 
> > > > Thanks
> > > 
> > > --
> 
> --

--

---

<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 23, 2012, 8:47pm UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/6 "2012-08-23T20:47:54Z")

</div>

Ivan,

Thank you very much, I fixed part of it with your help. It still needs some  
other tune up.. I'll post again with the current issue

Cheers

On Wednesday, August 22, 2012 1:51:42 PM UTC-4, Ivan Brusic wrote:

> Your mapping is incorrect. The first field in the JSON mapping refers  
> to the type (which is redundant given the URL, but that's how it is).
> 
> Take a look at the PUT mapping example:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html)
> 
> Also, your mapping redefines employmentHistory but the facet is on  
> educationHistory.
> 
> Cheers,
> 
> Ivan
> 
> On Wed, Aug 22, 2012 at 8:01 AM, maverick \<[mauricio...@gmail.com](mailto:mauricio...@gmail.com)\<javascript:\>\>  
> wrote:
> 
> > Thanks Vineeth,
> > 
> > actually there is one, check the mapping, is a multi\_field one of them  
> > is  
> > "name" the other is "nameFacet" that is analyzed with "keyword"  
> > analyzer..
> > 
> > In any case, not even the educationHistory.name works
> > 
> > Any other ideas?
> > 
> > On Wednesday, August 22, 2012 9:48:04 AM UTC-4, Vineeth Mohan wrote:
> > 
> > > There is not a single feed with data in the field -
> > > 
> > > educationHistory.nameFacet
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Wed, Aug 22, 2012 at 6:49 PM, maverick [mauricio...@gmail.com](mailto:mauricio...@gmail.com)  
> > > wrote:
> > > 
> > > > Bump!.. nobody? c'mon guys
> > > > 
> > > > On Monday, August 20, 2012 5:12:31 PM UTC-4, maverick wrote:
> > > > 
> > > > > Hi guys
> > > > > 
> > > > > I'm trying to do a term facet query over a nested object but I  
> > > > > haven't  
> > > > > been able to make it work. I was wondering if someone can give me  
> > > > > some  
> > > > > insights on my mistake?
> > > > > 
> > > > > I've gisted here [https://gist.github.com/3407734](https://gist.github.com/3407734) but I always got  
> > > > > zero  
> > > > > term facets. I've done other facets many times but seems that  
> > > > > there's a  
> > > > > trick on this one.
> > > > > 
> > > > > Thanks
> > > > 
> > > > --
> > 
> > --

--

---

<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:15am UTC](https://discuss.elastic.co/t/inner-nested-object-term-facet-question-gisted/8792/7 "2017-07-06T03:15:16Z")

</div>


