Increment date

You probably did not understand me. I already got this answer. Now I need to find the maximum value from those received with an interval of every hour.

"aggregations" : {
    "myDatehistogram" : {
      "buckets" : [
        {
          "key_as_string" : "2021-12-24T23:59:30.000Z",
          "key" : 1640390370000,
          "doc_count" : 845,
          "the_count" : {
            "value" : null
          }
        },
        {
          "key_as_string" : "2021-12-25T00:00:30.000Z",
          "key" : 1640390430000,
          "doc_count" : 2277,
          "the_count" : {
            "value" : 845.0
          }
        },
        {
          "key_as_string" : "2021-12-25T00:01:30.000Z",
          "key" : 1640390490000,
          "doc_count" : 1839,
          "the_count" : {
            "value" : 845.0
          }
        },
        {
          "key_as_string" : "2021-12-25T00:02:30.000Z",
          "key" : 1640390550000,
          "doc_count" : 1615,
          "the_count" : {
            "value" : 845.0
          }
        },
        {
          "key_as_string" : "2021-12-25T00:03:30.000Z",
          "key" : 1640390610000,
          "doc_count" : 1474,
          "the_count" : {
            "value" : 845.0
          }
        },
        {
          "key_as_string" : "2021-12-25T00:04:30.000Z",
          "key" : 1640390670000,
          "doc_count" : 1861,
          "the_count" : {
            "value" : 845.0
          }
        }