SELECTED_LABELS allows to request only a subset of the key-value pair labels of a serie.
An important note is that SELECTED_LABELS and WITHLABELS are mutualy exclusive.
* WITHLABELS - Include in the reply the label-value pairs that represent metadata labels of the time series. If `WITHLABELS` or `SELECTED_LABELS` are not set, by default, an empty Array will be replied on the labels array position.
* SELECTED_LABELS - Include in the reply a subset of the label-value pairs that represent metadata labels of the time series. This is usefull when you have a large number of labels per serie but are only interested in the value of some of the labels. If `WITHLABELS` or `SELECTED_LABELS` are not set, by default, an empty Array will be replied on the labels array position.
Example:
Query time series with metric=cpu, but only reply the team label
127.0.0.1:6379> TS.ADD ts1 1 90 labels metric cpu metric_name system team NY
(integer) 1
127.0.0.1:6379> TS.ADD ts1 2 45
(integer) 2
127.0.0.1:6379> TS.ADD ts2 2 99 labels metric cpu metric_name user team SF
(integer) 2
127.0.0.1:6379> TS.MRANGE - + SELECTED_LABELS team FILTER metric=cpu
1) 1) "ts1"
2) 1) 1) "team"
2) "NY"
3) 1) 1) (integer) 1
2) 90
2) 1) (integer) 2
2) 45
2) 1) "ts2"
2) 1) 1) "team"
2) "SF"
3) 1) 1) (integer) 2
2) 99
Changes to TS.MRANGE / MREVRANGE
SELECTED_LABELS allows to request only a subset of the key-value pair labels of a serie. An important note is that
SELECTED_LABELS
andWITHLABELS
are mutualy exclusive.More detailed args specs:
Example:
Query time series with metric=cpu, but only reply the team label