【问题标题】:Subtract two values in Kibana for specific timestamps在 Kibana 中减去两个值以获得特定的时间戳
【发布时间】:2017-04-26 06:19:12
【问题描述】:

这是我第一次这样做,似乎无法找到在线资源。

该指数按日汇总。所以每天一条记录。

4 月 26 日:

    {
  "_index": "gamers",
  "_type": "dailyAgg",
  "_id": "dailyAgg-2015-04-26T00:00:00Z",
  "_score": null,
  "_source": {
    "timestamp": "2017-04-26T00:00:00Z",
    "player_count": 800
  },
    "timestamp": [
      1493164800000
    ]
  },
  "sort": [
    1493164800000
  ]
}

4 月 25 日:

{
  "_index": "gamers",
  "_type": "dailyAgg",
  "_id": "dailyAgg-2017-04-25T00:00:00Z",
  "_score": null,
  "_source": {
    "timestamp": "2017-04-25T00:00:00Z",
    "player_count": 500
  },
    "timestamp": [
      1493078400000
    ]
  },
  "sort": [
    1493078400000
  ]
}

我需要的是:

player_count(今天) - player_count(昨天)

=> player_count(4 月 26 日) - player_count(4 月 25 日) = 800 - 500 = 300

我尝试过脚本化字段和无痛脚本,但无法提取给定日期的数据。

【问题讨论】:

    标签: elastic-stack kibana-5


    【解决方案1】:

    这是我最终使用的解决方案:Custom Plugin

    【讨论】:

      猜你喜欢
      • 2016-07-13
      • 1970-01-01
      • 1970-01-01
      • 2017-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多