Nullpointerexception on has_child query


(Markusahlstrand) #1

We running this query and get the error below even though both documents exists and are stored in the same shard. Any idea on why this doesn't work?

GET an-alias/a-type/_search
{
"query":   {
   "has_child": {
        "type": "xxx",
        "query": {
            "term": {
                "id": "123456"
            }
        }
    }
},
 "fields": [
    "id"
 ]
}
{
   "error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[xxx][an-alias][0]: RemoteTransportException[[instance-0000000015][inet[/xxx.xxx.xxx.xxx:19081]][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[[an-alias][0]: query[filtered(child_filter[acast/channel](filtered(id:123456)->cache(_type:acast)))->cache(+_type:channel +org.elasticsearch.index.search.nested.NonNestedDocsFilter@2c2a7c93)],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: RuntimeException[java.lang.NullPointerException]; nested: NullPointerException; }{[UpUal0ttSG2Vcn_GKRDM4g][an-alias][1]: RemoteTransportException[[instance-0000000013][inet[/xxx.xxx.xxx.xxx:xxxx]][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[[an-alias[1]: query[filtered(child_filter[acast/channel](filtered(id:123456)->cache(_type:acast)))->cache(+_type:channel +org.elasticsearch.index.search.nested.NonNestedDocsFilter@a1bb26e0)],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: RuntimeException[java.lang.NullPointerException]; nested: NullPointerException; }{[UpUal0ttSG2Vcn_GKRDM4g][an-alias][2]: RemoteTransportException[[instance-0000000013][inet[/xxx.xxx.xxx.xxx:xxxxx]][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[[an-alias6][2]: query[filtered(child_filter[acast/channel](filtered(id:123456)->cache(_type:acast)))->cache(+_type:channel +org.elasticsearch.index.search.nested.NonNestedDocsFilter@a1bb26e0)],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: RuntimeException[java.lang.NullPointerException]; nested: NullPointerException; }]",
   "status": 500
}
```

It works just fine with the same dataset on other clusters with the same version of elasticsearch.

Kind regards,
Markus

(Luca Cavanna) #2

Hi Markus,
could you please post a complete recreation that includes your mappings and documents?

Thanks
Luca


(system) #3