以下映射在使用另一个字段对文档进行分组的字段上的多个级别上聚合。
映射:
{
'predictions': {
'properties': {
'Company':{'type':'string'},
'TxnsId':{'type':'string'},
'Emp':{'type':'string'},
'Amount':{'type':'float'},
'Cash/online':{'type':'string'},
'items':{'type':'float'},
'timestamp':{'type':'date'}
}
}
}
我的要求有点复杂,我需要
- 对于每个 Emp(获取不同的员工)
- 检查是在线交易还是现金交易
- 按范围为 0-10,11-20,21-30...的项目分组
- 合计金额
最终输出如下:
>Emp-online-range-Amount
>a-online-(0-10)-1240$
>a-online-(21-30)-3543$
>b-online-(0-10)-2345$
>b-online-(11-20)-3456$