December 2017
Intermediate to advanced
434 pages
10h 29m
English
Finding the count of unique elements can be done with the cardinality aggregation. It is similar to finding the result of a query such as the following:
select count(*) from (select distinct username from usageReport) u;
Finding the cardinality or the number of unique values for a specific field is a very common requirement. If you have click-stream from the different visitors on your website, you may want to find out how many unique visitors you got in a given day, week, or month.
Let us understand how we find out the count of unique users for which we have network traffic data:
GET bigginsight/_search{ "aggregations": { "unique_visitors": { "cardinality": { "field": "username" } } }, "size": 0}
The cardinality aggregation ...
Read now
Unlock full access