Is a filtered has_child query possible where the filter is applied to the 
child document before the query of the has_child?

e.g. Given the example below...

curl -X PUT "http://localhost:9200/foobar"; -d 
"{\"mappings\":{\"Foo\":{},\"Bar\":{\"_parent\":{\"type\":\"Foo\"}}}}"

curl -X PUT "http://localhost:9200/foobar/Foo/1"; 
-d "{\"foo\":\"abc\",\"access\":\"yes\"}"

curl -X PUT "http://localhost:9200/foobar/Bar/2?parent=1"; 
-d "{\"bar\":\"xyz\",\"access\":\"no\"}"

The following filtered query should not return a result, if the filter was 
being applied to the child document first.

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

Please advise.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/575c3aa3-169d-4f00-b353-9e54291da432%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to