Elastic Search Null pointer exception in two different join types while fetching their parents

I have very simple mapping in Elastic Search 6.x version, and following is my mapping with two different types bookmarks user can also be bookmarked and post can also be bookmarked,

{ "properties": { "type": { "type": "join", "relations": { "user": [ "user_bookmarks" ], "post": [ "post_bookmarks" ] } } } }

I am trying to fetch both types of bookmarks on a same time , with their parent as inner_hits using has_parent block

GET /trending/doc/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "bool": {
            "must": [
              {
                "term": {
                  "type": "user_bookmarks"
                }
              },
              {
                "has_parent": {
                  "parent_type": "user",
                  "inner_hits":{
                    "_source":["id"]
                  },
                  "query": {
                    "match_all": {}
                  }
                }
              }
            ]
          }
        },
        {
          "bool": {
            "must": [
              {
                "term": {
                  "type": "post_bookmarks"
                }
              },
              {
                "has_parent": {
                  "parent_type": "post",
                 
                   "inner_hits":{
                    "_source":["id"]
                  },
                  "query": {
                    "match_all": {}
                  }
                }
              }
            ]
          }
        }
      ]
    }
  }
}

But i get the following error in has_parent inner_hits

{ "took" : 1, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 4, "skipped" : 0, "failed" : 1, "failures" : [ { "shard" : 3, "index" : "trending", "node" : "hTYvbi70QKGHZvuFYHtnlA", "reason" : { "type" : "null_pointer_exception", "reason" : null } } ] }, "hits" : { "total" : 1, "max_score" : 10.267918, "hits" : [ ] } }

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