TS.QUERYINDEX filterExpr...
Available in:
Redis Stack / TimeSeries 1.0.0
Time complexity:
O(n) where n is the number of time-series that match the filters

Get all time series keys matching a filter list


Required arguments

filterExpr... filters time series based on their labels and label values. Each filter expression has one of the following syntaxes:
  • label=value, where label equals value
  • label!=value, where label does not equal value
  • label=, where key does not have label label
  • label!=, where key has label label
  • label=(value1,value2,...), where key with label label equals one of the values in the list
  • label!=(value1,value2,...), where key with label label does not equal any of the values in the list


  • At least one label=value filter is required.
  • Filters are conjunctive. For example, the FILTER type=temperature room=study means the a time series is a temperature time series of a study room.
  • Don't use whitespaces in the filter expression.

Note: The QUERYINDEX command cannot be part of transaction when running on a Redis cluster.

Return value

Returns one of these replies:


Find keys by location and sensor type

Create a set of sensors to measure temperature and humidity in your study and kitchen.> TS.CREATE telemetry:study:temperature LABELS room study type temperature
OK> TS.CREATE telemetry:study:humidity LABELS room study type humidity
OK> TS.CREATE telemetry:kitchen:temperature LABELS room kitchen type temperature
OK> TS.CREATE telemetry:kitchen:humidity LABELS room kitchen type humidity

Retrieve keys of all time series representing sensors located in the kitchen.> TS.QUERYINDEX room=kitchen
1) "telemetry:kitchen:humidity"
2) "telemetry:kitchen:temperature"

To retrieve the keys of all time series representing sensors that measure temperature, use this query:> TS.QUERYINDEX type=temperature
1) "telemetry:kitchen:temperature"
2) "telemetry:study:temperature"

See also



Rate this page