I don’t get the examples that have - +
in the command. I’m probably missing something that is well-known and I’m just not aware/or know where to get the info but for example at https://redis.io/docs/stack/timeseries/quickstart/
They have command
TS.RANGE sensor1 - + FILTER_BY_TS 1626435230501 1626443276598
but I don’t get what the - +
is. Does anyone know?
2
Answers
The command format is:
TS.RANGE key fromTimestamp toTimestamp
From the doc:
So in your case, it means DO NOT filter data by timestamp.
TS.RANGE, TS.REVRANGE, TS.MRANGE, and TS.MREVRANGE are range commands. You need to specify the range start and end timestamps.
Instead of specifying concrete values, you can you
-
and+
respectively.RedisTimeSeries replaces
-
with the timestamp of the earliest sample in the time series, and+
with the timestamp of the latest sample in the time series.Note that the query you composed
would report samples only for two specific timestamps: 1626435230501 and 1626443276598, as
FILTER_BY_TS
is used for specifying a set of exact timestamps – not a range (to retrieve results, you must have samples with these exact timestamps, and these timestamps must fall within [fromTimestamp
..toTimestamp
] which is [-
..+
] in your case).If you want to retrieve all samples between timestamp 1626435230501 and timestamp 1626443276598, you should instead use
And if you want to retrieve all samples in the time series, you can use