Painless: Any easy way to define dates like now-1d, now-2d

We have a painless script to compare a logic before a date. Currently the user have to enter epoch value into the params, but was checking if you guys already have a script or logic, so we can use the "range" notations in the parameters?

        "my_hostnames": {
          "bucket_selector": {
            "buckets_path": {
              "time_max": "time_max"
            },
            "script": """
            params.time_max > 1628294400000L
            """
          }
        }

So i.e. time of Yesterday (1 day before) and we could have entered that as now-1d/d format and is there a way we could do that using painless?

So ultimately we are looking for a simplified usage for end-user

            "script": """
            params.time_max > now-1d/d
            """

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