# Query with facet\_filter with a nested filter fails

**URL:** https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394
**Category:** Elasticsearch
**Created:** [August 29, 2013, 2:16pm UTC](https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394 "2013-08-29T14:16:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![btiernay](https://avatars.discourse-cdn.com/v4/letter/b/bb73d2/32.png) [@btiernay](https://discuss.elastic.co/u/btiernay)
#### Post date: [August 29, 2013, 2:16pm UTC](https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394/1 "2013-08-29T14:16:58Z")

</div>

Hi all,

I was curious if it is possible to use a nested filter inside a  
facet\_filter. I have curl gist that illustrates the failure I'm getting:

> <https://gist.github.com/btiernay/6378567>

Any idea what, if anything, I am doing wrong?

Thanks!

Bob

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![h\_b\_wassenaar](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@h\_b\_wassenaar](https://discuss.elastic.co/u/h_b_wassenaar)
#### Post date: [August 29, 2013, 2:59pm UTC](https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394/2 "2013-08-29T14:59:24Z")

</div>

There's an error in the gist, on line 17,18, where it says

"list":{  
"nested1":"nested",  
This should be

"nested1":{  
"type":"nested",

And then in the search query, line 62, use

"path":"nested1.nested2",

With those changes it works for me.

--Harmen

On Thursday, August 29, 2013 4:16:58 PM UTC+2, btiernay wrote:

> Hi all,
> 
> I was curious if it is possible to use a nested filter inside a  
> facet\_filter. I have curl gist that illustrates the failure I'm getting:
> 
> [Example that shows how using a `facet_filter` with a `nested` filter fails to return `nested` facet terms. · GitHub](https://gist.github.com/btiernay/6378567)
> 
> Any idea what, if anything, I am doing wrong?
> 
> Thanks!
> 
> Bob

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![btiernay](https://avatars.discourse-cdn.com/v4/letter/b/bb73d2/32.png) [@btiernay](https://discuss.elastic.co/u/btiernay)
#### Post date: [August 29, 2013, 3:36pm UTC](https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394/3 "2013-08-29T15:36:07Z")

</div>

Oh, my mistake. Thanks for your help!

On Thursday, 29 August 2013 10:59:24 UTC-4, h.b.wa...@alumnus.rug.nl wrote:

> There's an error in the gist, on line 17,18, where it says
> 
> "list":{  
> "nested1":"nested",  
> This should be
> 
> "nested1":{  
> "type":"nested",
> 
> And then in the search query, line 62, use
> 
> "path":"nested1.nested2",
> 
> With those changes it works for me.
> 
> --Harmen
> 
> On Thursday, August 29, 2013 4:16:58 PM UTC+2, btiernay wrote:
> 
> > Hi all,
> > 
> > I was curious if it is possible to use a nested filter inside a  
> > facet\_filter. I have curl gist that illustrates the failure I'm getting:
> > 
> > [Example that shows how using a `facet_filter` with a `nested` filter fails to return `nested` facet terms. · GitHub](https://gist.github.com/btiernay/6378567)
> > 
> > Any idea what, if anything, I am doing wrong?
> > 
> > Thanks!
> > 
> > Bob

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![btiernay](https://avatars.discourse-cdn.com/v4/letter/b/bb73d2/32.png) [@btiernay](https://discuss.elastic.co/u/btiernay)
#### Post date: [August 29, 2013, 3:54pm UTC](https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394/4 "2013-08-29T15:54:20Z")

</div>

Okay, I've updated the gist which now correctly parses, but still  
illustrates the issue of not returning facets after applying a nested  
filter:

> <https://gist.github.com/btiernay/6378567>

Is this a real issue?

On Thursday, 29 August 2013 10:59:24 UTC-4, h.b.wa...@alumnus.rug.nl wrote:

> There's an error in the gist, on line 17,18, where it says
> 
> "list":{  
> "nested1":"nested",  
> This should be
> 
> "nested1":{  
> "type":"nested",
> 
> And then in the search query, line 62, use
> 
> "path":"nested1.nested2",
> 
> With those changes it works for me.
> 
> --Harmen
> 
> On Thursday, August 29, 2013 4:16:58 PM UTC+2, btiernay wrote:
> 
> > Hi all,
> > 
> > I was curious if it is possible to use a nested filter inside a  
> > facet\_filter. I have curl gist that illustrates the failure I'm getting:
> > 
> > [Example that shows how using a `facet_filter` with a `nested` filter fails to return `nested` facet terms. · GitHub](https://gist.github.com/btiernay/6378567)
> > 
> > Any idea what, if anything, I am doing wrong?
> > 
> > Thanks!
> > 
> > Bob

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:18am UTC](https://discuss.elastic.co/t/query-with-facet-filter-with-a-nested-filter-fails/13394/5 "2017-07-06T02:18:59Z")

</div>


