想象一下我有一个这样的边缘文档:
[{
"_from": "mobiles/12345",
"_to": "mobiles/54321",
"type": "call",
},
{
"_from": "mobiles/54321",
"_to": "mobiles/32145",
"type": "sms",
},
{
"_from": "mobiles/54321",
"_to": "mobiles/12345",
"type": "call",
}]
我需要在 54321 上查询时得到这样的列表:
{"54321":3, "12345":2,"32145":1}
我试过这个,但这不是我要找的:
for v,e,p in any "mobiles/54321" docs
COLLECT from = e._from , to = e._to with count into len
return {from, to, len}
我在 Elasticsearch 中使用 aggs 查询很容易做到这一点