Metric aggregation visualization via kibana


(Higee) #1

Hi, I'm curious how I could visualize metric aggregation via kibana.

My data is as follows:

date price
10/1 1
10/1 1.5
10/2 2.2
10/2 2.3
10/2 1.2
10/3 2.3
10/3 3.3
...

Basically what I'm trying to do is count the number of documents per day and calculate cumulative sum. In the case shown above, the result would be:

date count cumulative_count
10/1 2 2
10/2 3 5
10/3 2 7

I could get the cumulative count via aggregation, and code is as follows:

POST index/_search
{
"size": 0,
"aggs" : {
"items_sold_per_day" : {
"date_histogram" : {
"field" : "date_seoul",
"interval" : "month"
},
"aggs": {
"item_sold_cumulative": {
"cumulative_sum": {
"buckets_path": "_count"
}
}
}
}
}
}

Now I'm stuck with how to visualize that result via Kibana.
I want to show two things in the graph.

  1. target goal
  2. how much we have achieved
    in monthly term. (that's why I need cumulative count result)

Any idea or suggestion would be greatly helpful.

Best

Gee


(Tim Sullivan) #2

You can achieve #2 using the .cusum function in Timelion. For #1 though, it would be tricky. You might have to create a separate data source with your target goals. You can chart multiple data sources in Timelion.


(system) #3