Edit Axha
Edit Axha

Reputation: 63

add average value of data in existing chart elasticsearch kibana

I have a project in kibana integrated with elastic search. In Kibana page I am displaying a chart with X(months) and Y(Euro) values.

I want to show a line in the chart that will show the average Euro value of all data.

For the moment I add a manual value to show the horizontal line in the chart. Chart example I want to show

I want to get average value automatically from my data in elastic search. Is there any option to do this task?

Thank you

Upvotes: 3

Views: 2763

Answers (1)

Priya Jain
Priya Jain

Reputation: 830

Considering it is timeseries data, timelion can be used.

I have created dummy data as follows:

POST /balance_new/doc?pretty
{
  "@timestamp": "2018-01-14T12:32:50.548Z",
  "amount":136.5
}

There are more entries present like this.

Timelion query:

.es(index='balance_new', timefield='@timestamp', metric=avg:amount).range(135,140).title('Average EUR Monthly').yaxis(label='Average EUR'), .es(index='balance_new', timefield='@timestamp', metric=avg:amount).aggregate(function=avg)

Graph look like: enter image description here

You can read more about timelion here: https://www.elastic.co/guide/en/kibana/current/timelion.html

Upvotes: 1

Related Questions