Unique field query in Timelion

(Luvpreet Singh) #1

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 ?

(Marius Dragomir) #2

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

(Luvpreet Singh) #3

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

(Marius Dragomir) #4

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

(system) #5

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