'Elasticsearch count aggregation number of buckets

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 ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source