我在 kibana 中有一个与 Elasticsearch 集成的项目。 在 Kibana 页面中,我显示了一个包含 X(月)和 Y(欧元)值的图表。
我想在图表中显示一条线,显示所有数据的欧元平均值(value)。
目前我添加了一个手动值来显示图表中的水平线。 Chart example I want to show
我想在 Elasticsearch 中自动从我的数据中获取平均值。是否有任何选项可以执行此任务?
谢谢
最佳答案
考虑到是时间序列数据,可以使用timelion。
我创建了如下虚拟数据:
POST /balance_new/doc?pretty
{
"@timestamp": "2018-01-14T12:32:50.548Z",
"amount":136.5
}
还有更多这样的条目。
Timelion 查询:
.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)
您可以在此处阅读有关 timelion 的更多信息:https://www.elastic.co/guide/en/kibana/current/timelion.html
关于elasticsearch - 在现有图表elasticsearch kibana中添加数据的平均值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48270418/