TS.QUERYINDEX
Since 1.1.0Time series
Syntax
TS.QUERYINDEX <filters>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.
| Condition | Matches series where |
|---|---|
l=v | label l is v |
l!=v | label 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.QUERYINDEXwith 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)