I'm quite new to ElasticSearch aggregations. I want to be able to count how many documents are retrieved with a not null field.
Here's what I do to count how many documents don't have a name
field.
{
"size": 3,
"query": {
"query_string": {
"query": "martin"
}
},
"aggs": {
"results_without_mb_id": {
"missing": {
"field": "name"
}
}
}
}
It works but I want to do the exact opposite. Is there an existing
aggregation?
Like above, just replace 'missing' with 'exists', and also add 'filter' key, so:
{ "size": 3,
"query": {
"query_string": {
"query" : "martin"
}
},
"aggs": {
"results_without_mb_id": {
"filter": {
"exists": {
"field": "name"
}
}
}
}