Counting returning users

I'd want to show both total count of users and number returning users (unique users with more than one logged session) on my dashboard. Unique count of users is easy to obtain using the unique_count aggregation on the logged user identifier field. However, I haven't figured out how to count users with more than one audit log entity.

Solution that I'm looking for would return number of unique returning users over time.

Things that I've already tried

  • Adding min_doc_count filter on unique_count: does not work as the underlying cardinality aggregation has no support for this
  • Using terms aggregation together with min_doc_count. Returns me all the users having more than one logged sessions together with the number of logged sessions. Total number of rows returned by this combination would cover my information need.

Do you know if there's a way to do this in Kibana visualizations?

I can't think of any query that will allow you to do that. But feel free to ask in the Elasticsearch part of this forum as they will have more knowledge on some aggregations and metrics not used in Kibana which might help you.