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"
}
}
}

}
}
}

 

posted on 2018-07-02 17:12  zhangfeitaimengle  阅读(979)  评论(0编辑  收藏  举报

导航