A single-value metrics aggregation that calculates an approximate count of distinct values. Assume you are indexing store sales and would like to count the unique number of sold products that match a query: resp = client.search( index="sales", size="0", aggs={ "type_count": { "cardinality": { "field": "type" } } }, ) print(resp) response = client.search( index: 'sales', size: 0, body: { aggregatio