【问题标题】:How to use Elasticsearch's scripted metric aggregations with Grafana如何在 Grafana 中使用 Elasticsearch 的脚本化指标聚合
【发布时间】:2016-06-08 15:02:28
【问题描述】:

我正在尝试在 grafana 中显示 elasticsearch scripted aggregation。 我不知道在 grafana UI 中的何处设置我的聚合脚本

Elasticsearch 聚合

{
  "scripted_metric": {
    "init_script": "_agg['transactions'] = []",
    "map_script": "if (doc['type'].value == \"sale\") { _agg.transactions.add(doc['amount'].value) } else { _agg.transactions.add(-1 * doc['amount'].value) }",
    "combine_script": "profit = 0; for (t in _agg.transactions) { profit += t }; return profit",
    "reduce_script": "profit = 0; for (a in _aggs) { profit += a }; return profit"
  }
}

Grafana 用户界面

【问题讨论】:

  • 据我所知没有实现。

标签: elasticsearch grafana


【解决方案1】:

曾几何时,可以切换 elasticsearch 的查询公式模式,类似于 Graphite 可用的模式。遗憾的是,此功能已被删除,但有一个相当受欢迎的功能请求将其恢复。您可以在此处仔细阅读问题的当前状态:https://github.com/grafana/grafana/issues/5428

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多