Skip to content

Metric "Count unique" #19

@couds

Description

@couds

Hi Thanks for your work on this plugin.

It is possible to count only unique values of certain term?

The use case its that I store all activity of the users, but if I use this at it is will count activity in total (per document) instead of per user (count active users for example)

A example dataset could be this

{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525000000000, "createdAt": 1525000000000, "daysBetween": 0, "userId": 1}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525000000000, "createdAt": 1525000000000, "daysBetween": 0, "userId": 1}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525000000000, "createdAt": 1525000000000, "daysBetween": 0, "userId": 2}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525000000000, "createdAt": 1525000000000, "daysBetween": 0, "userId": 1}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525086400000, "createdAt": 1525000000000, "daysBetween": 1, "userId": 1}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525086400000, "createdAt": 1525000000000, "daysBetween": 1, "userId": 2}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525086400000, "createdAt": 1525000000000, "daysBetween": 1, "userId": 2}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525172800000, "createdAt": 1525000000000, "daysBetween": 2, "userId": 1}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525172800000, "createdAt": 1525000000000, "daysBetween": 2, "userId": 1}
{"index": {"_index": "my-index", "_type": "doc"}}
{"timestamp": 1525259200000, "createdAt": 1525000000000, "daysBetween": 3, "userId": 2}

With this dataset I get this

image

But I wanted something like

total date 0 1 2 3
6 2018/04/29 2 2 1 1

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions