elasticsearch - 在现有图表elasticsearch kibana中添加数据的平均值

标签 elasticsearch charts logstash kibana elasticsearch-plugin

我在 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)

图表看起来像:enter image description here

您可以在此处阅读有关 timelion 的更多信息:https://www.elastic.co/guide/en/kibana/current/timelion.html

关于elasticsearch - 在现有图表elasticsearch kibana中添加数据的平均值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48270418/

相关文章:

hadoop - Elasticsearch 在单个查询请求中更新多个字段

javascript - 如何创建过去二十四小时的 Google 面积图

javascript - Google 图表生成 1px 分隔符

logstash 简单文件输入/输出

json - 在logstash中解析嵌套的json

regex - 多行的正则表达式模式是什么(logstash)

c# - 带过滤器的 Elasticsearch 建议

node.js - 如何在没有elasticsearch-curator的情况下删除所有旧索引?

javascript - 如何用常量数据显示highchart y轴

elasticsearch - Elasticsearch-从结构中删除字段