How to do date histogram again after date histogram aggregation?

Now my aggregation is 5 min date histogram aggregation and then sum the result in every 5 min.

Now my DSL is similar to:

{
  "size": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "time": {
              "gt": "2020-03-31 11:30:00",
              "lt": "2020-03-31 13:00:00"
            }
          }
        },
        {
          "term": {
            "domain": "s3plus-shon.meituan.net"
          }
        }
      ]
    }
  },
  "aggs": {
    "flux_stats": {
      "date_histogram": {
        "field": "time",
        "interval": "5m",
        "format": "yyyy-MM-dd HH:mm:ss"
      },
      "aggs": {
        "flux": {
          "sum": {
            "field": "visit_flux"
          }
        }
      }
    }
  }
}

But I want to do date histogram sub aggregation again on the result, but the interval is 30 min and then find the max value in every 30 min, how can I do that?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.