Innerhits not returning results with has_parent filter


(Ashish Goel) #1

Hi there,

I am using ElasticSearch 1.5

In a particular index of mine, I have two types linked to each other via parent-child relationship.
Let's call parent type as pType and child type as cType.

If I execute this filter on pType:

{
    "filter": {
        "has_child":{
            "type": "cType",
            "filter":{
                "match_all":{}
            },
            "inner_hits":{}
        }
    }
}

This provides me some pType documents and innerhits contain some cType documents.

On the other hand, if I execute this filter on cType:

{
    "filter": {
        "has_parent":{
            "type": "pType",
            "filter":{
                "match_all":{}
            },
            "inner_hits":{}
        }
    }
}

This returns the cType documents but the innerhits are empty. When I check the document returned by this filter individually, I can see that the parent field is set for these documents and the parent value is corresponding to an existing pType document. I also checked the routing value for these documents. The cType documents and the corresponding pType document have the same value for routing.

Not sure if it matters, in the entire mapping, pType document is a child of yet another type, lets call it gpType (grand parent type :slight_smile: ). This issue is not existing when executing the same queries for gpType and pType.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.