Skip to content

nested filter within a facet_filter fails to return nested facet terms #3615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
btiernay opened this issue Sep 4, 2013 · 3 comments
Closed

Comments

@btiernay
Copy link

btiernay commented Sep 4, 2013

The general query form that exhibits this behavior is:

{
   "size":0,
   "facets":{
      "nested1":{
         "terms":{
            "field":"x"
         },
         "nested":"nested1",
         "facet_filter":{
            "nested":{
               "path":"nested1",
               "query":{
                  "match_all":{}
               }
            }
         }
      }
   }
}

Please see the curl recreation example here:

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

@junjun-zhang
Copy link

With "join": false option, facet will produce desired result. When join is disabled, facet will apply to the nested documents instead of the joined root document. See #2606 for more details.

{
   "size":0,
   "facets":{
      "nested1":{
         "terms":{
            "field":"x"
         },
         "nested":"nested1",
         "facet_filter":{
            "nested":{
               "path":"nested1",
               "join":false,
               "query":{
                  "match_all":{}
               }
            }
         }
      }
   }
}

@btiernay
Copy link
Author

@junjun-zhang Ah, very nice. Didn't know that option existed as it is undocumented. Thanks :)

@junjun-zhang
Copy link

Yes, this should be documented, and maybe "join":false should be the default when join option is omitted. I assume more users expect nested facets work on nested docs instead of joined root docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants