I am trying to find a way to convert the interval of a date histogram into seconds, but despite scouring the entirety of the docs and any stackoverflow posts that could potentially be relevant, I have come up with nothing of use. I want to run functions on different fields, but the result depends on time. Is there any way (short of hard-coding it into the inline script and manually changing it when I need to change the interval) that I can convert the interval time to a normalized time unit?
Maybe I'm misunderstanding your question but the interval of the date histogram takes the following time units:
So for example you could specify "60s" for 60 seconds.
What I want to do is convert the time internally to seconds. Like, if I had the interval be 12h, it would become 43200s so that a bucket script could run with that. If I changed the interval to 1d or 1w, I wouldn't have to manually adjust the script to accommodate the new interval