【发布时间】:2017-02-22 17:44:32
【问题描述】:
如果我在弹性搜索中有子父映射。 我将如何根据孩子的统计数据搜索父母。
例子:
{
'parent':{
'_id':{
'path':'parent_id'
},
'properties':{
'parent_id':{
'type':'string'
},
'name':{
'type':'string'
},
'job':{
'type':'string'
},
'age':{
'type':'integer'
},
}
}
}{
'child':{
'_parent':{
'type':'parent'
},
'_id':{
'path':'child_id'
},
'properties':{
'child_id':{
'type':'string'
},
'name':{
'type':'string'
},
'favorite_toy':{
'type':'string'
},
'age':{
'type':'integer'
},
}
}
}
我会怎么做:
- 获取所有有一个名为“bob”的孩子的父母?
- 计算所有有一个名为“bob”的孩子的父母?
- 获取所有有两个以上孩子的父母?
- 获取所有有 2 个 5 岁以上孩子的父母?
【问题讨论】:
标签: elasticsearch