I need to calculate the unique number of string values in a field with multiple query conditions. Here's an example:
There are 2 fields:
CUSTOMER_NAME (with values like "John", "Jack", "Marie", etc.)
BOUGHT_ITEM (with values like 1, 2, 3, 4, etc. - these are string values, not numbers)
I need to run a Timelion command to select unique count of CUSTOMER_NAME who bought (at least) both items 1 and 2 (at different times). Therefore, the result would be 2 (customers) because John and Marie bought items 1 and 2.
The following Timelion query ONLY counts unique customer who bought item 1. How do I make it so to get unique customer count who bought both items 1 AND 2?
.es(index=customer, q='BOUGHT_ITEM:1', metric=cardinality:CUSTOMER_NAME.keyword)
Please help! Thanks so much!