How to prevent query execution within certain hours of the day?

Hi,

I'd like to prevent the execution of a query within certain hours of the day.
The solution that comes into my mind is to use a painless script filter for this like

 "query": {
    "bool": {
      "filter": [
        {
          ... more filters for the real query here ...
        },
        {
       "script": {
          "script": {
            "source": """
  int hour = LocalDateTime.ofInstant(Instant.ofEpochMilli(new Date().getTime()),ZoneId.of('Europe/Zurich')).getHour();
  return params.hour_start <= hour && hour <= params.hour_end;
            """,
            "lang": "painless",
            "params": {
              "hour_start": 2,
              "hour_end": 5
            }
          }
        }
        }
      ]
    }
  },

But I fear that this generates unwanted load (due to the creation of objects that are only needed for making sure that the query gets executed in non-office-hours).

Any ideas how to improve this?

Best regards from sunny Black Forest, Germany,
Mattin