如何从祖父母那里获得 elasticsearch 7.10 中的所有孙子
How to get all grandchild in elasticsearch 7.10 from the grandparent
我在 elasticsearch 中有一个关系,其中 A 是 parent,B 是 A 的 child,而 C 是 B 的 child。
A->B->C.
在插入时,B 与 A 的关系与 parent 相同,而在插入 grandchild 时,B 是 parent.
现在,当我想使用以下查询获取所有 grandchild 时,它返回 None.
{
"query": {
"has_parent": {
"parent_type": "A",
"query": {
"has_parent": {
"parent_type": "B",
"query": {
"match_all": {}
}
}
}
}
}
}
这是什么问题?存储任何帮助时我是否遗漏了一些东西表示赞赏。
我使用以下查询实现了它。
{
"query": {
"has_parent": {
"parent_type": "B",
"query": {
"has_parent": {
"parent_type": "A",
"query": {
"match_all": {}
}
}
}
}
}
}
基本上应该嵌套父项而不是子项。
我在 elasticsearch 中有一个关系,其中 A 是 parent,B 是 A 的 child,而 C 是 B 的 child。
A->B->C.
在插入时,B 与 A 的关系与 parent 相同,而在插入 grandchild 时,B 是 parent.
现在,当我想使用以下查询获取所有 grandchild 时,它返回 None.
{
"query": {
"has_parent": {
"parent_type": "A",
"query": {
"has_parent": {
"parent_type": "B",
"query": {
"match_all": {}
}
}
}
}
}
}
这是什么问题?存储任何帮助时我是否遗漏了一些东西表示赞赏。
我使用以下查询实现了它。
{
"query": {
"has_parent": {
"parent_type": "B",
"query": {
"has_parent": {
"parent_type": "A",
"query": {
"match_all": {}
}
}
}
}
}
}
基本上应该嵌套父项而不是子项。