Unique field query in Timelion

I want to make a visualization using Timelion.

I want to plot the count of documents only where a field is unique. In my case it is the user_id of the user.

How do I put the condition that some field should be unique in Timelion expression ?

You can use the Cardinality metric for this.
.es(*, metric='cardinality:user_id')

1 Like

Thank you. It was helpful.
Can you please elaborate this cardinality thing ?

It's a term commonly used in SQL for counting the number of unique elements in a set.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.