Hello,
I have 100 documents with an boolean field, 80 docs are true, 20 are false.
How can I return only the "true" ones in an aggregation?
I'm looking for an aggregation similar to this sql:
SELECT count(*) FROM docs WHERE field = 'true';
I've tried an Term-Aggregation, but that returns also the false-values:
"myField": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0,
"key_as_string": "false",
"doc_count": 20
}
,
{
"key": 1,
"key_as_string": "true",
"doc_count": 80
}
]
}
Is there a shorter aggregation, which count's only me "true"-fields?
Best regards,
Stefan