You have to specify each timeperiod yes, but it can be done in a single request as the timeperiod field takes an array of timeperiods. The plot of non-afk time for days/weeks/months/years in the web-ui works this way. Here’s a direct copy of the request from the web-ui
{
"query":[
"afkbucket = \"aw-watcher-afk_johan-laptop2\";",
"not_afk = flood(query_bucket(afkbucket));",
"not_afk = merge_events_by_keys(not_afk, [\"status\"]);",
"RETURN = not_afk;"
],
"timeperiods":[
"2020-05-14T04:00:00+02:00/2020-05-15T04:00:00+02:00",
"2020-05-15T04:00:00+02:00/2020-05-16T04:00:00+02:00",
"2020-05-16T04:00:00+02:00/2020-05-17T04:00:00+02:00",
"2020-05-17T04:00:00+02:00/2020-05-18T04:00:00+02:00",
"2020-05-18T04:00:00+02:00/2020-05-19T04:00:00+02:00",
"2020-05-19T04:00:00+02:00/2020-05-20T04:00:00+02:00",
"2020-05-20T04:00:00+02:00/2020-05-21T04:00:00+02:00",
"2020-05-21T04:00:00+02:00/2020-05-22T04:00:00+02:00",
"2020-05-22T04:00:00+02:00/2020-05-23T04:00:00+02:00",
"2020-05-23T04:00:00+02:00/2020-05-24T04:00:00+02:00",
"2020-05-24T04:00:00+02:00/2020-05-25T04:00:00+02:00",
"2020-05-25T04:00:00+02:00/2020-05-26T04:00:00+02:00",
"2020-05-26T04:00:00+02:00/2020-05-27T04:00:00+02:00",
"2020-05-27T04:00:00+02:00/2020-05-28T04:00:00+02:00",
"2020-05-28T04:00:00+02:00/2020-05-29T04:00:00+02:00",
"2020-05-29T04:00:00+02:00/2020-05-30T04:00:00+02:00",
"2020-05-30T04:00:00+02:00/2020-05-31T04:00:00+02:00",
"2020-05-31T04:00:00+02:00/2020-06-01T04:00:00+02:00",
"2020-06-01T04:00:00+02:00/2020-06-02T04:00:00+02:00",
"2020-06-02T04:00:00+02:00/2020-06-03T04:00:00+02:00",
"2020-06-03T04:00:00+02:00/2020-06-04T04:00:00+02:00",
"2020-06-04T04:00:00+02:00/2020-06-05T04:00:00+02:00",
"2020-06-05T04:00:00+02:00/2020-06-06T04:00:00+02:00",
"2020-06-06T04:00:00+02:00/2020-06-07T04:00:00+02:00",
"2020-06-07T04:00:00+02:00/2020-06-08T04:00:00+02:00",
"2020-06-08T04:00:00+02:00/2020-06-09T04:00:00+02:00",
"2020-06-09T04:00:00+02:00/2020-06-10T04:00:00+02:00",
"2020-06-10T04:00:00+02:00/2020-06-11T04:00:00+02:00",
"2020-06-11T04:00:00+02:00/2020-06-12T04:00:00+02:00",
"2020-06-12T04:00:00+02:00/2020-06-13T04:00:00+02:00",
"2020-06-13T04:00:00+02:00/2020-06-14T04:00:00+02:00"
]
}
If I understand the question this works the same way, the difference is just that it’s not in the query language itself but rather in the request which contains the query.
We are trying to avoid having date handling in the query language because we want it to be focused on only transforming data, we’d prefer to keep date management out of it.
It’s also a good thing because that means that the client can decide timezone so aw-server doesn’t have to be aware of that.