2
說我有一個父文檔elasticsearch中子文檔的子聚合?
curl -XPUT es-host:9200/index/parent_type/1 -d '{
"foo": "bar"
}'
,我有一個子文檔
curl -XPUT es-host:9200/index/child_type/?parent=1 -d '{
"child-foo-1": "child-bar-1",
"child-foo-2": "child-bar-2"
}'
有沒有什麼辦法讓在父文件聚合子聚合爲我的孩子的文檔數據,有點像,
{
"aggregations": {
"foo-aggregations": {
"buckets": [
{
"key": "bar",
"doc_count": 1,
"child-foo-1-aggregations": {
"key": "child-bar-1",
"doc_count": 1
},
"child-foo-2-aggregations": {
"key": "child-bar-2",
"doc_count": 1
}
}
]
}
}
}