Opensearch rollup job fails with max metric

Hi,
I am trying to use a rollup job but it fails when I try to use the max metrics. The error I get is

{
  "rollup-test" : {
    "metadata_id" : "UVEpxYIBqb51AUG9ssaI",
    "rollup_metadata" : {
      "rollup_id" : "rollup-test",
      "last_updated_time" : 1661165220488,
      "continuous" : {
        "next_window_start_time" : 1651363200000,
        "next_window_end_time" : 1651449600000
      },
      "status" : "failed",
      "failure_reason" : "failed to parse field [Length.max] of type [float] in document with id 'R766Ut9LtN-y3OK12fjBGA'. Preview of field's value: '-Infinity'",
      "stats" : {
        "pages_processed" : 1,
        "documents_processed" : 125624,
        "rollups_indexed" : 0,
        "index_time_in_millis" : 0,
        "search_time_in_millis" : 3
      }
    }
  }
}

I’ve used the max metric in a rollup job before and I never had any problem. I guess this is a problem with the terms I want to aggregate, but there is any way to fix it or I am just trying to achive something that is not possible?