如何将分钟数据汇总到每小时?

时间:2019-02-18 13:20:45

标签: elasticsearch kibana

我想将一定时间段后的分钟数据平均为每小时一次。为此将是什么查询。可能的查询是什么?

查询结构为-

 GET ml_test_meters-2019_6/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "*",
            "analyze_wildcard": true
          }
        },
        {
          "range": {
            "host-status.meta.current-time": {
              "gte": 1549611907552,
              "lte": 1549654551498,
              "format": "epoch_millis"
            }
          }
        }
      ],
      "must_not": []
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "date_histogram": {
        "field": "host-status.meta.current-time",
        "interval": "1m",
        "time_zone": "US/Central",
        "min_doc_count": 1
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "host-status.name.keyword",
            "size": 500,
            "order": {
              "1": "desc"
            }
          },
          "aggs": {
            "1": {
              "avg": {
                "field": "host-status.status-properties.status-detail.total-cpu-stat-iowait"
              }
            }
          }
        }
      }
    }
  }
}

我需要查询以将总分钟数求和然后除以60

0 个答案:

没有答案