GET /nontax_t_daystat_income/_search
{
"size" : 0,
"_source" : false,
"stored_fields" : "_none_",
"aggs" : {
"aaa" : {
"composite" : {
"size" : 2,
"sources" : [
{
"dist_name" : {
"terms" : {
"field" : "DIST_NAME",
"missing_bucket" : true,
"order" : "asc"
}
}
},
{
"unit_name" : {
"terms" : {
"field" : "UNIT_NAME",
"missing_bucket" : true,
"order" : "asc"
}
}
}
]
},
"aggs" : {
"amount" : {
"avg" : {
"field" : "AMOUNT"
}
}
}
}
}
}
想实现select count(1) from (select DIST_NAME,UNIT_NAME,sum(AMOUNT) from aaa group by DIST_NAME,UNIT_NAME) 这个sql的效果
{
"size" : 0,
"_source" : false,
"stored_fields" : "_none_",
"aggs" : {
"aaa" : {
"composite" : {
"size" : 2,
"sources" : [
{
"dist_name" : {
"terms" : {
"field" : "DIST_NAME",
"missing_bucket" : true,
"order" : "asc"
}
}
},
{
"unit_name" : {
"terms" : {
"field" : "UNIT_NAME",
"missing_bucket" : true,
"order" : "asc"
}
}
}
]
},
"aggs" : {
"amount" : {
"avg" : {
"field" : "AMOUNT"
}
}
}
}
}
}
想实现select count(1) from (select DIST_NAME,UNIT_NAME,sum(AMOUNT) from aaa group by DIST_NAME,UNIT_NAME) 这个sql的效果
0 个回复