Find gap between _time

Hello, I’m new to Influxdb and store data as below

2022-04-08T11:00:00Z    2345.64
2022-04-08T11:01:00Z    2365.3
2022-04-08T11:02:00Z    2124.6
2022-04-08T11:03:00Z    2200.12
2022-04-08T11:04:00Z    2187.65
2022-04-08T11:08:00Z    2130.12
2022-04-08T11:10:00Z    2187.65

All my _time are separate by one minute. I’d like to make a query to find the missing data, a result that could look like


Do you know if it’s possible ? I’m using influxdb-client-java

@yoobi You could use aggregateWindow() to generate tables for each missing point. This should work if you set the every parameter to the same interval that your data should be coming in. You can then filter those results by rows for which a _value does not exist:

    |> aggregateWindow(every: 1m, timeSrc: "_start", createEmpty: true)
    |> filter(fn: (r) => not exists r._value)

Thank you for your reply, unfortunately I can’t make it work, aggregateWindow is requiring a fn. I don’t know what to fill in ?

Oh, right. Sorry. Just use last.

    |> aggregateWindow(every: 1m, fn: last, timeSrc: "_start", createEmpty: true)
    |> filter(fn: (r) => not exists r._value)
1 Like