concept cardinality in category elasticsearch

This is an excerpt from Manning's book Elasticsearch in Action.
For both numeric and non-numeric fields you can get the number of unique values using the cardinality aggregation, which will be discussed in section 7.2.3.
For cardinality, let’s imagine you want the number of unique members of your get-together site. The following listing shows how to do that with the cardinality aggregation.
Listing 7.7. Getting the number of unique members through the cardinality aggregation
URI=localhost:9200/get-together/group/_search curl "$URI?pretty&search_type=count" -d '{ "aggregations": { "members_cardinality": { "cardinality": { "field": "members" } } }}' ### reply "aggregations" : { "members_cardinality" : { "value" : 8 } }Like the percentiles aggregation, the cardinality aggregation is approximate. To understand the benefit of such approximation algorithms, let’s take a closer look at the alternative. Before the cardinality aggregation was introduced in version 1.1.0, the common way to get the cardinality of a field was by running the terms aggregation you saw in section 7.1. Because the terms aggregation will get the counts of each term for top N terms, where N is the configurable size parameter, if you specify a size large enough, you could get all the unique terms back. Counting them will give you the cardinality.