-
Notifications
You must be signed in to change notification settings - Fork 341
DEV: (cmds) add TS.QUERYLABELS command page #3633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dwdougherty
wants to merge
2
commits into
feature-oss-8.10
Choose a base branch
from
DOC-6837
base: feature-oss-8.10
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+242
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| --- | ||
| acl_categories: | ||
| - '@read' | ||
| - '@timeseries' | ||
| arguments: | ||
| - arguments: | ||
| - display_text: LABELS | ||
| name: LABELS | ||
| token: LABELS | ||
| type: pure-token | ||
| - arguments: | ||
| - display_text: VALUES | ||
| name: VALUES | ||
| token: VALUES | ||
| type: pure-token | ||
| - display_text: label | ||
| name: label | ||
| type: string | ||
| name: VALUES | ||
| type: block | ||
| name: subtype | ||
| type: oneof | ||
| - arguments: | ||
| - display_text: FILTER | ||
| name: FILTER | ||
| token: FILTER | ||
| type: pure-token | ||
| - display_text: filterExpr | ||
| multiple: true | ||
| name: filterExpr | ||
| type: string | ||
| name: FILTER | ||
| optional: true | ||
| type: block | ||
| arity: -2 | ||
| categories: | ||
| - docs | ||
| - develop | ||
| - stack | ||
| - oss | ||
| - rs | ||
| - rc | ||
| - oss | ||
| - kubernetes | ||
| - clients | ||
| command_flags: | ||
| - readonly | ||
| - module | ||
| complexity: O(n) where n is the number of time-series that match the filters (all | ||
| indexed series when FILTER is omitted) | ||
| description: Get all label names, or all values of a given label, for time series | ||
| matching a filter list, or all series | ||
| group: timeseries | ||
| hidden: false | ||
| hints: | ||
| - dont_cache | ||
| linkTitle: TS.QUERYLABELS | ||
| module: timeseries | ||
| railroad_diagram: /images/railroad/ts.querylabels.svg | ||
| since: 8.10.0 | ||
| summary: Get all label names, or all values of a given label, for time series matching | ||
| a filter list, or all series | ||
| syntax_fmt: "TS.QUERYLABELS <LABELS | VALUES label> [FILTER filterExpr\n [filterExpr\ | ||
| \ ...]]" | ||
| title: TS.QUERYLABELS | ||
| --- | ||
| {{< note >}} | ||
| This command's behavior varies in clustered Redis environments. See the [multi-key operations]({{< relref "/develop/using-commands/multi-key-operations" >}}) page for more information. | ||
| {{< /note >}} | ||
|
|
||
| Get all label names, or all values of a given label, for the time series matching a filter list (or all series when no filter is given). | ||
|
|
||
| [Examples](#examples) | ||
|
|
||
| ## Required arguments | ||
|
|
||
| <details open> | ||
| <summary><code>LABELS | VALUES label</code></summary> | ||
|
|
||
| selects what the command returns: | ||
|
|
||
| - `LABELS` - returns the set of distinct label names used by the matching time series. | ||
| - `VALUES label` - returns the set of distinct values of `label` used by the matching time series. The result is empty (not an error) when `label` does not exist or when no matching series carries it. | ||
|
|
||
| Each name or value appears at most once, regardless of how many series it belongs to. The order of the results is not defined. | ||
| </details> | ||
|
|
||
| ## Optional arguments | ||
|
|
||
| <details open> | ||
| <summary><code>FILTER filterExpr [filterExpr ...]</code></summary> | ||
|
|
||
| restricts the command to the time series whose labels and label values match all of the filter expressions. When `FILTER` is omitted, the command considers all indexed time series. | ||
|
|
||
| Each filter expression has one of the following syntaxes: | ||
|
|
||
| - `label!=` - the time series has a label named `label` | ||
| - `label=value` - the time series has a label named `label` with a value equal to `value` | ||
| - `label=(value1,value2,...)` - the time series has a label named `label` with a value equal to one of the values in the list | ||
| - `label=` - the time series does not have a label named `label` | ||
| - `label!=value` - the time series does not have a label named `label` with a value equal to `value` | ||
| - `label!=(value1,value2,...)` - the time series does not have a label named `label` with a value equal to any of the values in the list | ||
|
|
||
| <note><b>Notes:</b> | ||
| - At least one filter expression with a syntax `label=value` or `label=(value1,value2,...)` is required. | ||
| - Filter expressions are conjunctive. For example, the filter `type=temperature room=study` means that `type=temperature` AND `room=study`. | ||
| - Whitespace is not allowed in a filter expression except between quotes or double quotes in values - for example, `x="y y"` or `x='(y y,z z)'`. | ||
| </note> | ||
| </details> | ||
|
|
||
| ## Examples | ||
|
|
||
| <details open> | ||
| <summary><b>List labels and label values for a set of sensors</b></summary> | ||
|
|
||
| Create a set of sensors to measure temperature and humidity in your study and kitchen. | ||
|
|
||
| {{< highlight bash >}} | ||
| redis> TS.CREATE telemetry:study:temperature LABELS room study type temperature | ||
| OK | ||
| redis> TS.CREATE telemetry:study:humidity LABELS room study type humidity | ||
| OK | ||
| redis> TS.CREATE telemetry:kitchen:temperature LABELS room kitchen type temperature | ||
| OK | ||
| redis> TS.CREATE telemetry:kitchen:humidity LABELS room kitchen type humidity | ||
| OK | ||
| {{< / highlight >}} | ||
|
|
||
| Retrieve the label names used by the time series located in the kitchen. | ||
|
|
||
| {{< highlight bash >}} | ||
| redis> TS.QUERYLABELS LABELS FILTER room=kitchen | ||
| 1) "room" | ||
| 2) "type" | ||
| {{< / highlight >}} | ||
|
|
||
| Retrieve the distinct values of the `type` label across all time series. | ||
|
|
||
| {{< highlight bash >}} | ||
| redis> TS.QUERYLABELS VALUES type | ||
| 1) "humidity" | ||
| 2) "temperature" | ||
| {{< / highlight >}} | ||
| </details> | ||
|
|
||
| ## Details | ||
|
|
||
| ### Access control | ||
|
|
||
| Unlike [`TS.QUERYINDEX`]({{< relref "commands/ts.queryindex/" >}}), which lists every matching key whether or not the user has read access to it, `TS.QUERYLABELS` silently omits the time series that the user is not allowed to read. Label names and values that belong only to unreadable series do not appear in the result. | ||
|
|
||
| ## Redis Software and Redis Cloud compatibility | ||
|
|
||
| | Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | | ||
| |:----------------------|:-----------------|:------| | ||
| | <span title="Not supported">❌ Standard</span><br /><span title="Not supported"><nobr>❌ Active-Active</nobr></span> | <span title="Not supported">❌ Standard</span><br /><span title="Not supported"><nobr>❌ Active-Active</nobr></span> | | | ||
|
|
||
| ## Return information | ||
|
|
||
| {{< multitabs id="ts-querylabels-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 label name (with `LABELS`) or a label value (with `VALUES`). 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 subtype, missing label after `VALUES`, or 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 label name (with `LABELS`) or a label value (with `VALUES`). 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 subtype, missing label after `VALUES`, or invalid filter expression. | ||
|
|
||
| {{< /multitabs >}} | ||
|
|
||
| ## See also | ||
|
|
||
| [`TS.QUERYINDEX`]({{< relref "commands/ts.queryindex/" >}}) | [`TS.CREATE`]({{< relref "commands/ts.create/" >}}) | [`TS.MGET`]({{< relref "commands/ts.mget/" >}}) | [`TS.MRANGE`]({{< relref "commands/ts.mrange/" >}}) | ||
|
|
||
| ## Related topics | ||
|
|
||
| [RedisTimeSeries]({{< relref "/develop/data-types/timeseries/" >}}) | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the other filter commands as well.