es多字段聚合

实现SQL Group By类似的效果select id,name ,sum(money) from table group by id,name

GET myindex/mytype/_search
{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"sexprof": {
"terms": {
"script": {
"inline": "doc['id'].value +'|'+ doc['name.keyword'].value "
}
},
"aggs": {
"fl": {
"sum": {
"field": "F_FL"
}
},
"shui":{
"sum": {
"field": "F_SHIJI_SHUI"
}
}
}

}
}
}

猜你喜欢

转载自www.cnblogs.com/zhangfeitaimengle/p/9254748.html