TS.QUERYINDEX

Since 1.1.0Time series

Syntax

TS.QUERYINDEX <filters>
  • ACL categories: @read, @slow, @timeseries
  • Arity: -1

Returns the keys of every time series whose labels match all the given conditions, sorted by key. Use it to find which series exist for a device, a room or a metric, before reading them with TS.MGET or TS.MRANGE, which take the same conditions after FILTER.

ConditionMatches series where
l=vlabel l is v
l!=vlabel l is not v, or is absent
l=label l is absent
l!=label l is present
l=(v1,v2)label l is one of these
l!=(v1,v2)label l is none of these, or is absent

Labels are set by TS.CREATE, TS.ADD when it creates a series, and TS.ALTER, whose changes show here at once. TS.QUERYLABELS lists the label names and values in use.

Reply

  • An array of keys; (empty array) if none match.
  • ERR FILTER is required for TS.QUERYINDEX with no condition.

Examples

> TS.QUERYINDEX kind=temp
1) "temp:1"
2) "temp:2"
> TS.QUERYINDEX room=(kitchen,hall) kind!=hum
1) "temp:1"
2) "temp:2"
> TS.QUERYINDEX room!=
1) "hum:1"
2) "temp:1"
3) "temp:2"
> TS.QUERYINDEX nolabel=x
(empty array)