Has_child query results


#1

So I am seeing different results when querying for a child document directly and when querying for it with has_child, and I am not sure why. So my direct query is as follows and returns two documents:

{
  "query": {
    "nested": {
      "path": "clinvar",
      "query": {
        "match": {
          "clinvar.term": {
            "query": "parkinson disease",
            "operator": "and"
          }
        }
      }
    }
  }
}

Now when I run essentially the same query but using has_child against the parent type as such:

{
  "query": {
    "has_child": {
        "type": "genomeVariants",
        "query": {
          "nested": {
            "path": "clinvar",
            "query": {
              "match": {
                "clinvar.term": {
                  "query": "parkinson disease",
                  "operator": "and"
                }
              }
            }
          }
        },
        "inner_hits" : {}
      }
  }
}

I only get one hit, which is one of the two documents I was expecting. Am I doing something wrong? Any help would be appreciated! Thanks!

Jeff


(system) #2