Given this elasticsearch query which mimics that sql request "select count(distinct(keyword))as nb from table"
{"aggs":{"nb":{"terms":{"field":"keyword","size":99999999}}}}
Is there any faster way of getting that total number of distinct keywords in my elastic ?
CodePudding user response:
Yes, you should use the cardinality aggregation, which is exactly what you want (unique count of terms).
