更新时间:2023-09-23 09:07:52
您可以使用条款
聚合与 min_doc_count:2
像这样
You'd do this with a terms
aggregation with min_doc_count: 2
like this
{
"size": 0,
"aggs": {
"countries": {
"terms": {
"field": "countryName"
},
"aggs": {
"ids": {
"terms": {
"field": "countryId",
"min_doc_count": 2
}
}
}
}
}
}
请注意, countryName
字段应为 not_analyzed
,以使其正常工作,或 countryName
字段是多字段,一个 not_analyzed
部分。
Note that the countryName
field should be not_analyzed
in order for this to work, or the countryName
field is a multi-field with a not_analyzed
part.