'apply the filter before the query' doesn't make any sense to me - what
would it filter? I suspect I'm not really understanding you, can you tell
me more? Why do you want to be able to do this? How would it help?


anyway, from what I thing I do understand there are several ways to get the
results you want. Which one you choose probably depends on how you want the
results scored, and possibly performance considerations.

here is one way to try. (If you want to filter both then you need to ...
apply the filter to both :))
something like:

{
   "query": {
      "filtered": {
         "query": {
            "has_child": {
               "type": "Bar",
               "query": {
                 "filtered": {
                    "query": {
                       "term": {
                           "bar": "xyz"
                        }
                    },
                    "filter": {
                       "term": {
                           "access": "yes"
                       }
                    }
                  }
               }
            }
         },
         "filter": {
            "term": {
               "access": "yes"
            }
         }
      }
   }
}

On Wed, Mar 11, 2015 at 9:15 PM, asanderson <[email protected]>
wrote:

> Actually, I  do want only parent documents returned, but I want the filter
> to be applied to both parent and child documents. Is there a way to specify
> that the filter is to be applied before the query, so that this would be
> possible? If not, how would I rewrite the query to do this?
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/05a86e8c-9ef2-4028-b937-e6370202e677%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAFps6aBXHyr67vCxHb6BYV42y6RS9QCzGQK4xKb6Qmh8jph8pA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to