我在检索我的"祖父母的inner_hits
时遇到问题"项目。
来自子查询的父母工作得很好,但是不能让它返回更高级别的那些。
有什么想法吗?
现在应该修复known issue(2.3)并根据嵌套对象编写workaround,而不是父/子层次结构数据,所以不能让它对我有效。< / p>
Sense-format代码:
POST /test/child/_search
{
"query": {
"has_parent": {
"type": "parent",
"query": {
"has_parent": {
"type": "grandparent",
"query": {
"match_all": {}
},
"inner_hits": {}
}
},
"inner_hits": {}
}
}
}
PUT /test/child/3?parent=2&routing=1
{
"id": 3,
"name": "child",
"parentid": 2
}
PUT /test/parent/2?parent=1&routing=1
{
"id": 2,
"name": "parent",
"parentid": 1
}
PUT /test/grandparent/1
{
"id": 1,
"name": "grandparent"
}
PUT /test
{
"mappings": {
"grandparent": {},
"parent": {
"_parent": {
"type": "grandparent"
}
},
"child": {
"_parent": {
"type": "parent"
}
}
}
}