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

时间:2019-02-15 11:01:34

标签: 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": "1h",
        "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"
              }
            }
          }
        }
      }
    }
  }
}

可能是什么解决方案?我想稍后将新数据插入相同的索引,并删除每分钟的数据。

0 个答案:

没有答案
相关问题