1 对单列求和
select sum(waybillNum) from waybillday where idCode='9e8376f0715ecc402f4673f6e8b74e19';
POST orderview-index/waybillday/_search
{"query": {
"match": {
"idCode": "9e8376f0715ecc402f4673f6e8b74e19"
}
},
"aggregations": {
"waybillNumSum": {
"sum": {
"field": "waybillNum"
}
}
}
}
2 分组统计明细量
select count(*) from detailstable group by destProvince,destCity
POST suzhou/suzhou/_search?pretty
{
"size": 0,
"query":{
"bool": {
"must": [
]
}
},
"aggs": {
"group_by_province": {
"terms": {
"field": "destProvince"
},
"aggs": {
"group_by_city": {
"terms": {
"field": "destCity"
}
}
}
}
}
}