【发布时间】:2020-02-08 07:09:21
【问题描述】:
我有这样的文件
文档-1
{
"edges" :[
{
"start" : "abc",
"end" : "def"
},
{
"start" : "bbb",
"end" : "ccc"
},
{
"start" : "xyz",
"end" : "aaa"
}
]
}
文档-2
{
"edges" :[
{
"start" : "abc",
"end" : "def"
},
{
"start" : "bbb",
"end" : "ccc"
}
]
}
我想获得 start 和 end 的独特组合。
即如下
{
"buckets": [
{
"key": {
"start": "abc",
"end": "def"
},
"doc_count": 2
},
{
"key": {
"start": "bbb",
"end": "ccc"
},
"doc_count": 2
},
{
"key": {
"start": "xyz",
"end": "aaa"
},
"doc_count": 1
}
]
}
我在start 和end 字段上尝试了术语聚合。但没有得到预期的输出。
【问题讨论】:
标签: elasticsearch elastic-stack elasticsearch-aggregation elasticsearch-query elasticsearch-mapping