Search code examples
elasticsearchkibanakibana-4

Kibana(Elasticsearch) count with uniq value


I use kibana-4

I logged like this,

{user_id: 1, taget: A}
{user_id: 1, taget: B}
{user_id: 1, taget: B}
{user_id: 1, taget: B}
{user_id: 2, taget: A}
{user_id: 2, taget: C}

And I want to draw Pie Chart(target count) that result like this.

A: 2, B: 1, C: 1

It means count only one by each user. How can I do? Can I user only Kibana's visualize options? or add some elasticsearch input?


Solution

  • In metrics field select Unique Count aggregation -> user_id field

    In buckets field select terms aggregation -> target field