Docs

v2.0

range() function

The range() function filters records based on time bounds. Each input table’s records are filtered to contain only records that exist within the time bounds. Records with a null value for their time are filtered. Each input table’s group key value is modified to fit within the time bounds. Tables where all records exists outside the time bounds are filtered entirely.

Function type: Transformation
*Output data type: Object

range(start: -15m, stop: now)

Parameters

start

Specifies the oldest time to be included in the results.

Relative start times are defined using negative durations. Negative durations are relative to now. Absolute start times are defined using timestamps.

Data type: Duration or Timestamp

stop

Specifies the exclusive newest time to be included in the results. Defaults to now.

Relative stop times are defined using negative durations. Negative durations are relative to now. Absolute stop times are defined using timestamps.

Data type: Duration or Timestamp

Examples

Time range relative to now
from(bucket:"telegraf/autogen")
  |> range(start:-12h)
  // ...
Relative time range
from(bucket:"telegraf/autogen")
  |> range(start:-12h, stop: -15m)
  // ...
Absolute time range
from(bucket:"telegraf/autogen")
  |> range(start:2018-05-22T23:30:00Z, stop: 2018-05-23T00:00:00Z)
  // ...

WHERE


Bug Reports and Feedback

Thank you for being willing to help test InfluxDB v2.0 alpha! Feedback and bug reports are welcome and encouraged both for InfluxDB and this documentation.

Submit feedback in the InfluxData Community