Hello,
I am using below query to group by a field and return the count, is there a way to return documents whose doc_count equals 1 (or less than 2)
GET logs-test*/_search
{
"aggs": {
"2": {
"terms": {
"field": "id",
"order": {
"_count": "asc"
},
"min_doc_count": 2
}
}
},
"size": 0,
"query": {
"bool": {
"must": [],
"filter": [
{
"match_phrase": {
"body.function": "myfunctionName"
}
},
{
"range": {
"timestamp": {
"gte": "2022-03-30T17:00:00.000Z",
"lte": "2022-03-31T16:59:59.999Z"
}
}
}
]
}
}
}
Thanks!