我有一个实体XEntity,该实体具有相同类型的子代列表。每个实体都可以有他的孩子的列表。它们通过“父子关系”相互关联。(https://www.elastic.co/guide/en/elasticsearch/client/net-api/master/parent-child-relationships.html)
我可以毫无问题地插入或更新这些实体,但是我无法聚在一起。谁能帮我?预先感谢。
答案 0 :(得分:0)
如果您使用的是父子关系,则可以按父级查找子级,反之亦然
Finding Children by Their Parents
GET /company/employee/_search
{
"query": {
"has_parent": {
"type": "branch",
"query": {
"match": {
"country": "UK"
}
},
"inner_hits": {}
}
}
}
还有Finding Parents by Their Children
GET /company/branch/_search
{
"query": {
"has_child": {
"type": "employee",
"query": {
"range": {
"dob": {
"gte": "1980-01-01"
}
}
},
"inner_hits": {}
}
}
}