From 2990154716f89ffa217975bd1af2acf20e34bbd1 Mon Sep 17 00:00:00 2001 From: "David W. Dougherty" Date: Tue, 29 Jul 2025 11:19:54 -0700 Subject: [PATCH 1/3] DEV: add RESP2/3 return information to the time series commands --- content/commands/ts.add.md | 25 +++++++++---- content/commands/ts.alter.md | 25 +++++++++---- content/commands/ts.create.md | 27 +++++++++----- content/commands/ts.createrule.md | 27 +++++++++----- content/commands/ts.decrby.md | 19 +++++++--- content/commands/ts.del.md | 27 +++++++++----- content/commands/ts.deleterule.md | 19 +++++++--- content/commands/ts.get.md | 30 +++++++++++----- content/commands/ts.incrby.md | 27 +++++++++----- content/commands/ts.info.md | 16 +++++++-- content/commands/ts.madd.md | 25 +++++++++---- content/commands/ts.mget.md | 36 +++++++++++++------ content/commands/ts.mrange.md | 59 +++++++++++++++++++++---------- content/commands/ts.mrevrange.md | 51 ++++++++++++++++++-------- content/commands/ts.queryindex.md | 25 +++++++++---- content/commands/ts.range.md | 25 +++++++++---- content/commands/ts.revrange.md | 25 +++++++++---- 17 files changed, 353 insertions(+), 135 deletions(-) diff --git a/content/commands/ts.add.md b/content/commands/ts.add.md index 554e8d67e3..de288982a9 100644 --- a/content/commands/ts.add.md +++ b/content/commands/ts.add.md @@ -213,13 +213,6 @@ Use it only if you are creating a new time series. It is ignored if you are addi - Setting `RETENTION` and `LABELS` introduces additional time complexity. -## Return value - -Returns one of these replies: - -- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. -- [] on error (invalid arguments, wrong key type, etc.), when duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp - ## Complexity If a compaction rule exists on a time series, the performance of `TS.ADD` can be reduced. @@ -246,6 +239,24 @@ Add a sample to the time series, setting the sample's timestamp to the current U {{< / highlight >}} +## Return information + +{{< multitabs id="ts-add-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp. + +-tab-sep- + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp. + +{{< /multitabs >}} + ## See also [`TS.CREATE`]({{< relref "commands/ts.create/" >}}) diff --git a/content/commands/ts.alter.md b/content/commands/ts.alter.md index 53dcad7a31..a18cad5077 100644 --- a/content/commands/ts.alter.md +++ b/content/commands/ts.alter.md @@ -119,13 +119,6 @@ is set of label-value pairs that represent metadata labels of the key and serve If `LABELS` is specified, the given label list is applied. Labels that are not present in the given list are removed implicitly. Specifying `LABELS` with no label-value pairs removes all existing labels. See `LABELS` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). -## Return value - -Returns one of these replies: - -- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly -- [] on error (invalid arguments, wrong key type, key does not exist, etc.) - ## Examples
Alter a temperature time series @@ -145,6 +138,24 @@ OK {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-alter-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is altered successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc. + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is altered successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc. + +{{< /multitabs >}} + ## See also [`TS.CREATE`]({{< relref "commands/ts.create/" >}}) diff --git a/content/commands/ts.create.md b/content/commands/ts.create.md index 5db2ac00dc..5829239cdb 100644 --- a/content/commands/ts.create.md +++ b/content/commands/ts.create.md @@ -180,14 +180,7 @@ is set of label-value pairs that represent metadata labels of the key and serve The [`TS.MGET`]({{< relref "commands/ts.mget/" >}}), [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}), and [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) commands operate on multiple time series based on their labels. The [`TS.QUERYINDEX`]({{< relref "commands/ts.queryindex/" >}}) command returns all time series keys matching a given filter based on their labels. -## Return value - -Returns one of these replies: - -- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly -- [] on error (invalid arguments, key already exists, etc.) - -## Examples +## Examples
Create a temperature time series @@ -197,6 +190,24 @@ OK {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-create-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is created successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, key already exists, etc. + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the time series is created successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, key already exists, etc. + +{{< /multitabs >}} + ## See also [`TS.ADD`]({{< relref "commands/ts.add/" >}}) | [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}) | [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) | [`TS.MGET`]({{< relref "commands/ts.mget/" >}}) | [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) | [`TS.QUERYINDEX`]({{< relref "commands/ts.queryindex/" >}}) diff --git a/content/commands/ts.createrule.md b/content/commands/ts.createrule.md index af768cb11e..f1d4b42ddb 100644 --- a/content/commands/ts.createrule.md +++ b/content/commands/ts.createrule.md @@ -151,13 +151,6 @@ ensures that there is a bucket that starts exactly at `alignTimestamp` and align For example, if `bucketDuration` is 24 hours (`24 * 3600 * 1000`), setting `alignTimestamp` to 6 hours after the Unix epoch (`6 * 3600 * 1000`) ensures that each bucket’s timeframe is `[06:00 .. 06:00)`. -## Return value - -Returns one of these replies: - -- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly -- [] on error (invalid arguments, wrong key type, etc.), when `sourceKey` does not exist, when `destKey` does not exist, when `sourceKey` is already a destination of a compaction rule, when `destKey` is already a source or a destination of a compaction rule, or when `sourceKey` and `destKey` are identical - ## Examples
@@ -184,9 +177,27 @@ Now, also create a compacted time series named _dailyDiffTemp_. This time series 127.0.0.1:6379> TS.CREATE dailyDiffTemp:TLV LABELS type temp location TLV 127.0.0.1:6379> TS.CREATERULE temp:TLV dailyDiffTemp:TLV AGGREGATION range 86400000 21600000 {{< / highlight >}} - +
+## Return information + +{{< multitabs id="ts-createrule-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is created successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `sourceKey` does not exist, `destKey` does not exist, `sourceKey` is already a destination of a compaction rule, `destKey` is already a source or a destination of a compaction rule, or `sourceKey` and `destKey` are identical. + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is created successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `sourceKey` does not exist, `destKey` does not exist, `sourceKey` is already a destination of a compaction rule, `destKey` is already a source or a destination of a compaction rule, or `sourceKey` and `destKey` are identical. + +{{< /multitabs >}} + ## See also [`TS.DELETERULE`]({{< relref "commands/ts.deleterule/" >}}) diff --git a/content/commands/ts.decrby.md b/content/commands/ts.decrby.md index 7e39279072..b692778af1 100644 --- a/content/commands/ts.decrby.md +++ b/content/commands/ts.decrby.md @@ -173,12 +173,23 @@ Use it only if you are creating a new time series. It is ignored if you are addi - Setting `RETENTION` and `LABELS` introduces additional time complexity. -## Return value +## Return information -Returns one of these replies: +{{< multitabs id="ts-decrby-return-info" + tab1="RESP2" + tab2="RESP3" >}} -- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. -- [] on error (invalid arguments, wrong key type, etc.), or when `timestamp` is not equal to or higher than the maximum existing timestamp +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. + +-tab-sep- + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. + +{{< /multitabs >}} ## See also diff --git a/content/commands/ts.del.md b/content/commands/ts.del.md index e74b21f9f7..f100f28587 100644 --- a/content/commands/ts.del.md +++ b/content/commands/ts.del.md @@ -69,14 +69,7 @@ The given timestamp interval is closed (inclusive), meaning that samples whose t -## Return value - -Returns one of these replies: - -- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the number of samples that were deleted -- [] on error (invalid arguments, wrong key type, etc.), when `timestamp` is older than the retention period compared to the maximum existing timestamp, or when an affected compaction bucket cannot be recalculated - -## Examples +## Examples
Delete range of data points @@ -107,6 +100,24 @@ Delete the range of data points for temperature in Tel Aviv. {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-del-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of samples that were deleted. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `timestamp` is older than the retention period compared to the maximum existing timestamp, or when an affected compaction bucket cannot be recalculated. + +-tab-sep- + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of samples that were deleted. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, `timestamp` is older than the retention period compared to the maximum existing timestamp, or when an affected compaction bucket cannot be recalculated. + +{{< /multitabs >}} + ## See also [`TS.ADD`]({{< relref "commands/ts.add/" >}}) diff --git a/content/commands/ts.deleterule.md b/content/commands/ts.deleterule.md index 076ff4b955..29a0e3b8ae 100644 --- a/content/commands/ts.deleterule.md +++ b/content/commands/ts.deleterule.md @@ -51,12 +51,23 @@ is key name for destination (compacted) time series. Note: This command does not delete the compacted series. -## Return value +## Return information -Returns one of these replies: +{{< multitabs id="ts-deleterule-return-info" + tab1="RESP2" + tab2="RESP3" >}} -- [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly -- [] on error (invalid arguments, etc.), or when such rule does not exist +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is deleted successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, or when such rule does not exist. + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` when the compaction rule is deleted successfully. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, or when such rule does not exist. + +{{< /multitabs >}} ## See also diff --git a/content/commands/ts.get.md b/content/commands/ts.get.md index 33c0cbf03f..04730db47a 100644 --- a/content/commands/ts.get.md +++ b/content/commands/ts.get.md @@ -55,14 +55,6 @@ is used when a time series is a compaction. With `LATEST`, TS.GET reports the co The data in the latest bucket of a compaction is possibly partial. A bucket is _closed_ and compacted only upon arrival of a new sample that _opens_ a new _latest_ bucket. There are cases, however, when the compacted value of the latest (possibly partial) bucket is also required. In such a case, use `LATEST`. -## Return value - -Returns one of these replies: - -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of a single ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pair representing (timestamp, value(double)) of the sample with the highest timestamp -- An empty [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) - when the time series is empty -- [] (invalid arguments, wrong key type, key does not exist, etc.) - ## Examples
@@ -135,7 +127,27 @@ Get the latest maximum daily temperature (the temperature with the highest times {{< / highlight >}}
- + +## Return information + +{{< multitabs id="ts-get-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of a single ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pair representing (timestamp, value) of the sample with the highest timestamp. +* An empty [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) when the time series is empty. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc. + +-tab-sep- + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of a single ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) pair representing (timestamp, value) of the sample with the highest timestamp. +* An empty [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) when the time series is empty. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, key does not exist, etc. + +{{< /multitabs >}} + ## See also [`TS.MGET`]({{< relref "commands/ts.mget/" >}}) diff --git a/content/commands/ts.incrby.md b/content/commands/ts.incrby.md index 5ae7a40cf5..9cfce54252 100644 --- a/content/commands/ts.incrby.md +++ b/content/commands/ts.incrby.md @@ -174,13 +174,6 @@ Use it only if you are creating a new time series. It is ignored if you are addi - Setting `RETENTION` and `LABELS` introduces additional time complexity. -## Return value - -Returns one of these replies: - -- [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. -- [] on error (invalid arguments, wrong key type, etc.), or when `timestamp` is not equal to or higher than the maximum existing timestamp - ## Examples
Store sum of data from several sources @@ -215,9 +208,27 @@ Suppose a sensor ticks whenever a car is passed on a road, and you want to count (integer) 1658431553109 {{< / highlight >}} -The timestamp is filled automatically. +The timestamp is filled automatically.
+## Return information + +{{< multitabs id="ts-incrby-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. + +-tab-sep- + +One of the following: +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. + +{{< /multitabs >}} + ## See also [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) | [`TS.CREATE`]({{< relref "commands/ts.create/" >}}) diff --git a/content/commands/ts.info.md b/content/commands/ts.info.md index 34bc0cc8c1..4688cc69d9 100644 --- a/content/commands/ts.info.md +++ b/content/commands/ts.info.md @@ -53,9 +53,13 @@ is key name of the time series. is an optional flag to get a more detailed information about the chunks. -## Return value +## Return information -[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with information about the time series (name-value pairs): +{{< multitabs id="ts-info-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with information about the time series as flattened name-value pairs: | Name
[Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) | Description | ---------------------------- | - @@ -79,6 +83,14 @@ When [`DEBUG`]({{< relref "/commands/debug" >}}) is specified, the response also | `keySelfName` | [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})
Name of the key | `Chunks` | [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with information about the chunks
Each element is an [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of information about a single chunk in a name([Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}))-value pairs:
- `startTimestamp` - [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - First timestamp present in the chunk
- `endTimestamp` - [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - Last timestamp present in the chunk
- `samples` - [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - Total number of samples in the chunk
- `size` - [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - the chunk's internal data size (without overheads) in bytes
- `bytesPerSample` - [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) (double) - Ratio of `size` and `samples` +-tab-sep- + +[Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) with information about the time series. The map contains the same fields as described in the RESP2 response, but organized as key-value pairs in a map structure rather than a flattened array. + +When [`DEBUG`]({{< relref "/commands/debug" >}}) is specified, the response also contains the additional `keySelfName` and `Chunks` fields as described above. + +{{< /multitabs >}} + ## Examples
diff --git a/content/commands/ts.madd.md b/content/commands/ts.madd.md index aca37e1dc7..4eea5038bc 100644 --- a/content/commands/ts.madd.md +++ b/content/commands/ts.madd.md @@ -74,13 +74,6 @@ is numeric data value of the sample (double). The double number should follow }}) command page for more information. -## Return value - -Returns one of these replies: - -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the timestamp of a upserted sample or an [] (when duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp). For each element that is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply element value will be the largest timestamp in the time series. -- [] (invalid arguments, wrong key type, etc.) - ## Complexity If a compaction rule exits on a time series, TS.MADD performance might be reduced. @@ -108,6 +101,24 @@ OK {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-madd-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the timestamp of a upserted sample. For each element that is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply element value will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp. + +-tab-sep- + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}), where each element is an [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the timestamp of a upserted sample. For each element that is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply element value will be the largest timestamp in the time series. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp. + +{{< /multitabs >}} + ## See also [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.RANGE`]({{< relref "commands/ts.range/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) | [`TS.REVRANGE`]({{< relref "commands/ts.revrange/" >}}) diff --git a/content/commands/ts.mget.md b/content/commands/ts.mget.md index 29f9d130b4..726c8a6341 100644 --- a/content/commands/ts.mget.md +++ b/content/commands/ts.mget.md @@ -133,16 +133,6 @@ If `WITHLABELS` or `SELECTED_LABELS` are not specified, by default, an empty lis Note: The [`MGET`]({{< relref "/commands/mget" >}}) command cannot be part of a transaction when running on a Redis cluster. -## Return value - -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: - - bulk-string-reply: The time series key name - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) - - By default, an empty array is reported - - If `WITHLABELS` is specified, all labels associated with this time series are reported - - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined) - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single timestamp-value pair ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) (double)) - ## Examples
@@ -204,6 +194,32 @@ To get only the `location` label for each last sample, use `SELECTED_LABELS`. {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-mget-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) + - By default, an empty array is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported + - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined) +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single timestamp-value pair ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) + +-tab-sep- + +[Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) or [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs + - By default, an empty array is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported as a map + - If `SELECTED_LABELS label...` is specified, the selected labels are reported as a map (null value when no such label defined) +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single timestamp-value pair ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) + +{{< /multitabs >}} + ## See also [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.RANGE`]({{< relref "commands/ts.range/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) | [`TS.REVRANGE`]({{< relref "commands/ts.revrange/" >}}) diff --git a/content/commands/ts.mrange.md b/content/commands/ts.mrange.md index a8b8e02c97..40a104462b 100644 --- a/content/commands/ts.mrange.md +++ b/content/commands/ts.mrange.md @@ -381,30 +381,53 @@ When combined with `AGGREGATION` the `GROUPBY`/`REDUCE` is applied post aggregat Note: An `MRANGE` command cannot be part of a transaction when running on a Redis cluster. -## Return value +## Return information + +{{< multitabs id="ts-mrange-return-info" + tab1="RESP2" + tab2="RESP3" >}} If `GROUPBY label REDUCE reducer` is not specified: -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: - - bulk-string-reply: The time series key name - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) - - By default, an empty array is reported - - If `WITHLABELS` is specified, all labels associated with this time series are reported - - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined) - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) (double)): all samples/aggregations matching the range +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) + - By default, an empty array is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported + - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined) +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range If `GROUPBY label REDUCE reducer` is specified: -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each group of time series matching the specified filters, the following is reported: - - bulk-string-reply with the format `label=value` where `label` is the `GROUPBY` label argument - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): - - By default, an empty array is reported - - If `WITHLABELS` is specified, the `GROUPBY` label argument and value are reported - - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined or label does not have the same value for all grouped time series) - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): either a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value, or empty array if - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by `,` - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) (double)): all samples/aggregations matching the range +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each group of time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) with the format `label=value` where `label` is the `GROUPBY` label argument +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): + - By default, an empty array is reported + - If `WITHLABELS` is specified, the `GROUPBY` label argument and value are reported + - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined or label does not have the same value for all grouped time series) +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): either a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value, or empty array if +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by `,` +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range + +-tab-sep- + +If `GROUPBY label REDUCE reducer` is not specified: + +[Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) or [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs + - By default, an empty map is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported as a map + - If `SELECTED_LABELS label...` is specified, the selected labels are reported as a map (null value when no such label defined) +- Additional metadata including aggregators information +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) representing all samples/aggregations matching the range + +If `GROUPBY label REDUCE reducer` is specified: + +Similar structure as RESP2 but with map-based organization for labels and metadata, and double values instead of string values. + +{{< /multitabs >}} ## Examples diff --git a/content/commands/ts.mrevrange.md b/content/commands/ts.mrevrange.md index ef96908965..7355a5f115 100644 --- a/content/commands/ts.mrevrange.md +++ b/content/commands/ts.mrevrange.md @@ -380,26 +380,49 @@ When combined with `AGGREGATION` the `GROUPBY`/`REDUCE` is applied post aggregat Note: An `MREVRANGE` command cannot be part of a transaction when running on a Redis cluster. -## Return value +## Return information + +{{< multitabs id="ts-mrevrange-return-info" + tab1="RESP2" + tab2="RESP3" >}} If `GROUPBY label REDUCE reducer` is not specified: -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: - - bulk-string-reply: The time series key name - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) - - By default, an empty list is reported - - If `WITHLABELS` is specified, all labels associated with this time series are reported - - If `SELECTED_LABELS label...` is specified, the selected labels are reported - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) (double)): all samples/aggregations matching the range +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) + - By default, an empty array is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported + - If `SELECTED_LABELS label...` is specified, the selected labels are reported +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range in reverse chronological order If `GROUPBY label REDUCE reducer` is specified: -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each group of time series matching the specified filters, the following is reported: - - bulk-string-reply with the format `label=value` where `label` is the `GROUPBY` label argument - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by `,` - - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) (double)): all samples/aggregations matching the range +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each group of time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) with the format `label=value` where `label` is the `GROUPBY` label argument +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by `,` +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range in reverse chronological order + +-tab-sep- + +If `GROUPBY label REDUCE reducer` is not specified: + +[Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) or [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs + - By default, an empty map is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported as a map + - If `SELECTED_LABELS label...` is specified, the selected labels are reported as a map +- Additional metadata including aggregators information +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) representing all samples/aggregations matching the range in reverse chronological order + +If `GROUPBY label REDUCE reducer` is specified: + +Similar structure as RESP2 but with map-based organization for labels and metadata, and double values instead of string values. + +{{< /multitabs >}} ## Examples diff --git a/content/commands/ts.queryindex.md b/content/commands/ts.queryindex.md index af806fd60f..c4da006398 100644 --- a/content/commands/ts.queryindex.md +++ b/content/commands/ts.queryindex.md @@ -75,13 +75,6 @@ filters time series based on their labels and label values. Each filter expressi Note: The `QUERYINDEX` command cannot be part of a transaction when running on a Redis cluster. -## Return value - -Returns one of these replies: - -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) where each element is a [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): a time series key. The array is empty if no time series matches the filter. -- [] (e.g., on invalid filter expression) - ## Examples
@@ -117,6 +110,24 @@ To retrieve the keys of all time series representing sensors that measure temper {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-queryindex-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) where each element is a [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): a time series key. The array is empty if no time series matches the filter. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid filter expression. + +-tab-sep- + +One of the following: +* [Set reply]({{< relref "/develop/reference/protocol-spec#sets" >}}) where each element is a [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): a time series key. The set is empty if no time series matches the filter. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid filter expression. + +{{< /multitabs >}} + ## See also [`TS.CREATE`]({{< relref "commands/ts.create/" >}}) | [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) | [`TS.MGET`]({{< relref "commands/ts.mget/" >}}) diff --git a/content/commands/ts.range.md b/content/commands/ts.range.md index 1f7c5ba672..bca1203a6a 100644 --- a/content/commands/ts.range.md +++ b/content/commands/ts.range.md @@ -265,13 +265,6 @@ is a flag, which, when specified, reports aggregations also for empty buckets. Regardless of the values of `fromTimestamp` and `toTimestamp`, no data is reported for buckets that end before the earliest sample or begin after the latest sample in the time series. -## Return value - -Returns one of these replies: - -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pairs representing (timestamp, value(double)) -- [] (e.g., on invalid filter value) - ## Complexity TS.RANGE complexity can be improved in the future by using binary search to find the start of the range, which makes this `O(Log(n/m)+k*m)`. @@ -392,6 +385,24 @@ When the start timestamp for the range query is explicitly stated (not `-`), you Similarly, when the end timestamp for the range query is explicitly stated, you can set `ALIGN` to that time by setting align to `+` or to `end`. +## Return information + +{{< multitabs id="ts-range-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pairs representing (timestamp, value). +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid filter value, wrong key type, key does not exist, etc. + +-tab-sep- + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) pairs representing (timestamp, value). +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid filter value, wrong key type, key does not exist, etc. + +{{< /multitabs >}} + ## See also [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.REVRANGE`]({{< relref "commands/ts.revrange/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) diff --git a/content/commands/ts.revrange.md b/content/commands/ts.revrange.md index d7a7fbed87..166babc6c9 100644 --- a/content/commands/ts.revrange.md +++ b/content/commands/ts.revrange.md @@ -264,13 +264,6 @@ is a flag, which, when specified, reports aggregations also for empty buckets. Regardless of the values of `fromTimestamp` and `toTimestamp`, no data is reported for buckets that end before the earliest sample or begin after the latest sample in the time series. -## Return value - -Returns one of these replies: - -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pairs representing (timestamp, value(double)) -- [] (e.g., on invalid filter value) - ## Complexity TS.REVRANGE complexity can be improved in the future by using binary search to find the start of the range, which makes this `O(Log(n/m)+k*m)`. @@ -393,6 +386,24 @@ When the start timestamp for the range query is explicitly stated (not `-`), you Similarly, when the end timestamp for the range query is explicitly stated, you can set ALIGN to that time by setting align to `+` or to `end`. +## Return information + +{{< multitabs id="ts-revrange-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) pairs representing (timestamp, value) in reverse chronological order. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid filter value, wrong key type, key does not exist, etc. + +-tab-sep- + +One of the following: +* [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) pairs representing (timestamp, value) in reverse chronological order. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid filter value, wrong key type, key does not exist, etc. + +{{< /multitabs >}} + ## See also [`TS.RANGE`]({{< relref "commands/ts.range/" >}}) | [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.MREVRANGE`]({{< relref "commands/ts.mrevrange/" >}}) From 878dcafab2156f6cb7e4021b1c4834182939e9ab Mon Sep 17 00:00:00 2001 From: David Dougherty Date: Fri, 1 Aug 2025 06:26:40 -0700 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: andy-stark-redis <164213578+andy-stark-redis@users.noreply.github.com> --- content/commands/ts.add.md | 4 ++-- content/commands/ts.decrby.md | 4 ++-- content/commands/ts.incrby.md | 4 ++-- content/commands/ts.mrange.md | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/commands/ts.add.md b/content/commands/ts.add.md index de288982a9..019d949b5f 100644 --- a/content/commands/ts.add.md +++ b/content/commands/ts.add.md @@ -246,13 +246,13 @@ Add a sample to the time series, setting the sample's timestamp to the current U tab2="RESP3" >}} One of the following: -* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp. -tab-sep- One of the following: -* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, duplication policy is `BLOCK`, or when `timestamp` is older than the retention period compared to the maximum existing timestamp. {{< /multitabs >}} diff --git a/content/commands/ts.decrby.md b/content/commands/ts.decrby.md index b692778af1..1e8f686fe4 100644 --- a/content/commands/ts.decrby.md +++ b/content/commands/ts.decrby.md @@ -180,13 +180,13 @@ Use it only if you are creating a new time series. It is ignored if you are addi tab2="RESP3" >}} One of the following: -* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. -tab-sep- One of the following: -* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. {{< /multitabs >}} diff --git a/content/commands/ts.incrby.md b/content/commands/ts.incrby.md index 9cfce54252..121e2a4fee 100644 --- a/content/commands/ts.incrby.md +++ b/content/commands/ts.incrby.md @@ -218,13 +218,13 @@ The timestamp is filled automatically. tab2="RESP3" >}} One of the following: -* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. -tab-sep- One of the following: -* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (See `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. +* [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the timestamp of the upserted sample. If the sample is ignored (see `IGNORE` in [`TS.CREATE`]({{< relref "commands/ts.create/" >}})), the reply will be the largest timestamp in the time series. * [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, wrong key type, or when `timestamp` is not equal to or higher than the maximum existing timestamp. {{< /multitabs >}} diff --git a/content/commands/ts.mrange.md b/content/commands/ts.mrange.md index 40a104462b..ed347b086b 100644 --- a/content/commands/ts.mrange.md +++ b/content/commands/ts.mrange.md @@ -407,7 +407,7 @@ If `GROUPBY label REDUCE reducer` is specified: - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined or label does not have the same value for all grouped time series) - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): either a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value, or empty array if - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by `,` +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by "," - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range -tab-sep- From a1ee552f2848941407eb990f0d6cfcdadea62c61 Mon Sep 17 00:00:00 2001 From: "David W. Dougherty" Date: Fri, 1 Aug 2025 06:31:45 -0700 Subject: [PATCH 3/3] Apply more suggestions from code review --- content/commands/ts.mrange.md | 2 +- content/commands/ts.mrevrange.md | 88 ++++++++++++++++---------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/content/commands/ts.mrange.md b/content/commands/ts.mrange.md index ed347b086b..5120a6cb36 100644 --- a/content/commands/ts.mrange.md +++ b/content/commands/ts.mrange.md @@ -405,7 +405,7 @@ If `GROUPBY label REDUCE reducer` is specified: - By default, an empty array is reported - If `WITHLABELS` is specified, the `GROUPBY` label argument and value are reported - If `SELECTED_LABELS label...` is specified, the selected labels are reported (null value when no such label defined or label does not have the same value for all grouped time series) -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): either a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value, or empty array if +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): either a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value, or empty array - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by "," - [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range diff --git a/content/commands/ts.mrevrange.md b/content/commands/ts.mrevrange.md index 7355a5f115..48991520e3 100644 --- a/content/commands/ts.mrevrange.md +++ b/content/commands/ts.mrevrange.md @@ -380,50 +380,6 @@ When combined with `AGGREGATION` the `GROUPBY`/`REDUCE` is applied post aggregat Note: An `MREVRANGE` command cannot be part of a transaction when running on a Redis cluster. -## Return information - -{{< multitabs id="ts-mrevrange-return-info" - tab1="RESP2" - tab2="RESP3" >}} - -If `GROUPBY label REDUCE reducer` is not specified: - -[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: -- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) - - By default, an empty array is reported - - If `WITHLABELS` is specified, all labels associated with this time series are reported - - If `SELECTED_LABELS label...` is specified, the selected labels are reported -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range in reverse chronological order - -If `GROUPBY label REDUCE reducer` is specified: - -[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each group of time series matching the specified filters, the following is reported: -- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) with the format `label=value` where `label` is the `GROUPBY` label argument -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by `,` -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range in reverse chronological order - --tab-sep- - -If `GROUPBY label REDUCE reducer` is not specified: - -[Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}): for each time series matching the specified filters, the following is reported: -- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name -- [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) or [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs - - By default, an empty map is reported - - If `WITHLABELS` is specified, all labels associated with this time series are reported as a map - - If `SELECTED_LABELS label...` is specified, the selected labels are reported as a map -- Additional metadata including aggregators information -- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) representing all samples/aggregations matching the range in reverse chronological order - -If `GROUPBY label REDUCE reducer` is specified: - -Similar structure as RESP2 but with map-based organization for labels and metadata, and double values instead of string values. - -{{< /multitabs >}} - ## Examples
@@ -618,6 +574,50 @@ Query all time series with the metric label equal to `cpu`, but only return the {{< / highlight >}}
+## Return information + +{{< multitabs id="ts-mrevrange-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +If `GROUPBY label REDUCE reducer` is not specified: + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})) + - By default, an empty array is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported + - If `SELECTED_LABELS label...` is specified, the selected labels are reported +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range in reverse chronological order + +If `GROUPBY label REDUCE reducer` is specified: + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): for each group of time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) with the format `label=value` where `label` is the `GROUPBY` label argument +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the `GROUPBY` label argument and value +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__reducer__` and the reducer argument +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): a single pair ([Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})): the string `__source__` and the time series key names separated by "," +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}})) representing all samples/aggregations matching the range in reverse chronological order + +-tab-sep- + +If `GROUPBY label REDUCE reducer` is not specified: + +[Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}): for each time series matching the specified filters, the following is reported: +- [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): The time series key name +- [Map reply]({{< relref "/develop/reference/protocol-spec#maps" >}}) or [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): label-value pairs + - By default, an empty map is reported + - If `WITHLABELS` is specified, all labels associated with this time series are reported as a map + - If `SELECTED_LABELS label...` is specified, the selected labels are reported as a map +- Additional metadata including aggregators information +- [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): timestamp-value pairs ([Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}), [Double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}})) representing all samples/aggregations matching the range in reverse chronological order + +If `GROUPBY label REDUCE reducer` is specified: + +Similar structure as RESP2 but with map-based organization for labels and metadata, and double values instead of string values. + +{{< /multitabs >}} + ## See also [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | [`TS.RANGE`]({{< relref "commands/ts.range/" >}}) | [`TS.REVRANGE`]({{< relref "commands/ts.revrange/" >}})