GET rule_index/_search
{
"size": 0,
"aggs": {
"rule_doc_count": {
"terms" : { "field" : "key.keyword" }
},
"rule_count":{
"cardinality": {
"field": "key.keyword"
}
}
}
}
Created
March 18, 2019 13:41
-
-
Save renshuki/afe5c9f4f6c97fdcf8d73f6952d477ee to your computer and use it in GitHub Desktop.
Elasticsearch term aggregation to regroup a field (key) and count the number of buckets using cardinality aggregation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment