Elastic join query not returning correct result

I have data in elastic with parent-child relationship. But both "has_child" and "has_parent" queries is missing few inner hits.

Query with "has_child" is returning 2 doc. But there are 3 doc. If I remove the "has_child" part of query, it returns 3 doc. But I know that the missing doc also have a child -

I have the same result when I look with "has_parent".

I can verify that the parent-child relationship exists for the missing doc -
This 2 is returned with the above query -
GET perfectorder_v2/order/mf806561363-1-sg830139117?_source=false&routing=mf806561363-1
GET perfectorder_v2/order/mf806561363-2-sg830139117?_source=false&routing=mf806561363-2

And this one not
GET perfectorder_v2/order/mf806561363-3-sg830139117?_source=false&routing=mf806561363-3

I can provide more details... but here few questions -

  1. Is having "-" in the _id have any impact?
  2. My mapping looks fine... but please let me know if this could be an issue

"perfectorder_v2": {
"mappings": {
"order": {
"properties": {
"doc_type": {
"type": "join",
"eager_global_ordinals": true,
"relations": {
"order_header": "order_line",
"order_line": [
"order_doc_type": {
"type": "keyword"

  1. I'm using ES 6.1.1 right now

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