0
我對新的inner_hits
功能有些麻煩。 當在父母/孩子上使用它時,它會起作用,但是如果我嘗試在孫子上使用它,它似乎不起作用。Elasticsearch在孫子們的內在點擊
這是我的映射
{
"test": {
"template": "test",
"settings": {
"index": {
"number_of_replicas": 0
}
},
"mappings": {
"parents": {
"dynamic": "strict",
"_routing": {
"required": true
},
"properties": {
"parent_value": {
"type": "string"
}
}
},
"children": {
"dynamic": "strict",
"_routing": {
"required": true
},
"_parent": {
"type": "parents"
},
"properties": {
"parent_id": {
"type": "string",
"index": "not_analyzed"
},
"child_value": {
"type": "string"
}
}
},
"grandchildren": {
"dynamic": "strict",
"_routing": {
"required": true
},
"_parent": {
"type": "children"
},
"properties": {
"children_id": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
我插入數據通過正義
PUT test/parents/parent_id?routing=1
{
"parent_value": "PARENT VALUE"
}
PUT test/children/child_id?routing=1&parent=parent_id
{
"parent_id": "parent_id",
"child_value": "CHILD VALUE"
}
PUT test/grandchildren/grandchild_id?routing=1&parent=child_id
{
"children_id": "child_id"
}
這完美的作品
GET test/children/_search?routing=1
{
"post_filter": {
"bool": {
"must": [
{
"has_parent": {
"parent_type": "parents",
"filter": {
"bool": {
"must": [
{
"ids": {
"values": ["parent_id"]
}
}
]
}
},
"inner_hits": {
}
}
}
]
}
}
}
耶!
但是,如果我嘗試這個,它會發現一個文件,但inner_hits
是空的。
GET test/grandchildren/_search?routing=1
{
"post_filter": {
"bool": {
"must": [
{
"has_parent": {
"parent_type": "children",
"filter": {
"bool": {
"must": [
{
"ids": {
"values": ["child_id"]
}
}
]
}
},
"inner_hits": {
}
}
}
]
}
}
}
我在做什麼錯誤..?