要求:
group by hldId having count(*) = 2
Elasticsearch查询:
"aggs": {
"groupByHldId": {
"terms": {
"field": "hldId","min_doc_count": 2,"order" : { "_count" : "asc" }
}
}
}
但没有记录返回
"aggregations" : {
"groupByHldId" : {
"doc_count_error_upper_bound" : -1,"sum_other_doc_count" : 2660,"buckets" : [ ]
}
}
但是如果更改为desc
,它就会返回
"buckets" : [
{
"key" : 200035075,"doc_count" : 355
},
或者,如果没有min_doc_count
,它也将返回
"buckets" : [
{
"key" : 200000061,"doc_count" : 1
},
那么为什么同时具有mid_doc_count
和asc
的方向却返回空?