假设这是我的文档,而book meta是一个嵌套字段
{
{
"Book ID": 1,
"Book Meta":
[
{
"Chapter_ID" : 1,
"Chapter_Gist": "<some-text-here>",
"Chapter_Tag": "tag-1"
},
{
"Chapter_ID" : 2,
"Chapter_Gist": "<some-text-here>",
"Chapter_Tag": "tag-2"
}
]
},
{
"Book ID": 2,
"Book Meta":
[
{
"Chapter_ID" : 1,
"Chapter_Gist": "<some-text-here>",
"Chapter_Tag": "tag-2"
},
{
"Chapter_ID" : 2,
"Chapter_Gist": "<some-text-here>",
"Chapter_Tag": "tag-3"
},
{
"Chapter_ID" : 3,
"Chapter_Gist": "<some-text-here>",
"Chapter_Tag": "tag-1"
}
]
}
}
在上面的例子中,我需要如下的聚合:{tag-1,tag-2}出现在book-1和book-2中,但是其他2个共现{tag-1,tag-3},{tag-2,tag-3}只出现在book-2中,所以聚合应该给我
tag-1, tag-2 : 2
tag-2, tag-3 : 1
tag-1, tag-3 : 1
是否将include\u in \u parent/include\u in \u root的组合用于在parent中获取一个平面字段,并使用无痛脚本连接这些值,然后计算工时,或者是否有其他方法来执行此操作。任何帮助都会很好!谢谢您!
暂无答案!
目前还没有任何答案,快来回答吧!