我对分组结果有下列查询,我想要添加到此查询中的是按字母顺序对分组值进行排序。
GET promote_kmp/audit_table/_search
{
"aggs":{
"group_by_table_name":{
"terms":{
"field":"table_name",
"size":1000000000
}
}
}
}
答案 0 :(得分:2)
只需添加order
setting:
POST promote_kmp/audit_table/_search
{
"aggs":{
"group_by_table_name":{
"terms":{
"field":"table_name",
"size":1000000000,
"order": { "_term": "asc" } <---- add this
}
}
}
}
答案 1 :(得分:1)
只需添加:
GET promote_kmp/audit_table/_search
{
"aggs":{
"group_by_table_name":{
"terms":{
"field":"table_name",
"size":1000000000,
"order": {
"_term": "asc"
}
}
}
}
}