假设事件发生类似于以下
我需要aggregation order
来像
有人可以帮我吗?
答案 0 :(得分:2)
您可以查看ordering terms aggregation
event_date
sub-aggregation
terms aggregation
{
"size": 0,
"aggs": {
"event_name": {
"terms": {
"field": "event_name",
"size": 10,
"order": {
"first_arrive": "asc"
}
},
"aggs": {
"first_event_occur": {
"min": {
"field": "event_date"
}
}
}
}
}
}