Before anyone suggests it, I am trying to use the terms aggregation with a very large size
value to get a more exact number as opposed to using cardinality
. I realize it's less efficient but I'm only searching around 75k records and it seems to only take ~400ms to run. If that's a bad idea for some reason let me know! If it's fine to do this, how can I get the count of buckets back from the search? Preferably, I don't want to get back the buckets themselves at all; just the count.
"aggs": {
"distinct": {
"terms": {
"field": "uniqueVal.enum",
"size": 100000
}
}
}