Here is my mapping
{
"mappings": {
"movie": {
"properties": {
"film_to_franchise": {
"type": "join",
"relations": {
"franchise": "film",
"film":"cast"
}
},
"id": {
"type": "text"
},
"is_private":{
"type":"boolean",
"index":true
},
"genre":{
"type": "text",
"index": true
},
"title":{
"type": "text",
"index": true
},
"franchise_name":{
"type": "text",
"index": true
},
"cast_name":{
"type": "text",
"index": true
},
"movie_name":{
"type": "text",
"index": true
}
}
}
}
}```
But I want to peform query in 3 levels, like those 3rd level values should come where parent = 2 and grand_parent = 1
here is my query
```GET series/movie/_search
{
"_source": [
"id",
"title",
"cast_name",
"film_to_franchise"
],
"query": {
"has_parent": {
"parent_type": "film",
"inner_hits": {
"_source": [
"title",
"movie_name"
]
},
"query": {
"terms": {
"id": [
"fr2"
]
},
"has_parent": {
"parent_type": "franchise",
"inner_hits": {
"_source": [
"title",
"franchise_name"
]
},
"query": {
"terms": {
"id": [
"fr2"
]
}
}
}
}
}
}
}
but it gives me following error
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[terms] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 23,
"col": 9
}
],
"type": "parsing_exception",
"reason": "[terms] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
"line": 23,
"col": 9
},
"status": 400
}```