以下语句的含义是,
从 es 中查询 在指定时间(snapshotTime)范围内的数据, 并且将数据按车牌进行分组统计(carPlateNumber),并且进行分页(bucket_sort), 每组显示一条数据详情(top_hits)
{
"from": 0,
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"snapshotTime": {
"from": 1668614400000,
"to": 1669975825019,
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"sort": [
{
"snapshotTime": {
"order": "desc"
}
}
],
"track_total_hits": 2147483647,
"aggregations": {
"carPlateNumber": {
"terms": {
"field": "carPlateNumber",
"size": 2147483647,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
},
"aggregations": {
"top_detail": {
"top_hits": {
"from": 0,
"size": 1,
"version": false,
"seq_no_primary_term": false,
"explain": false
}
},
"pv_count": {
"value_count": {
"field": "carPlateNumber"
}
},
"r_bucket_sort": {
"bucket_sort": {
"sort": {
"pv_count": {
"order": "desc"
}
},
"from": 10,
"size": 10
}
}
}
}
}
}
标签:sort,count,hits,top,bucket,aggregations
From: https://www.cnblogs.com/panie2015/p/16963045.html