Skip to content

Commit 4a533ca

Browse files
committed
DEV: add hash, JSON, and time series to secondary indexing page
1 parent 9bcb951 commit 4a533ca

File tree

1 file changed

+28
-0
lines changed
  • content/develop/use/patterns/indexes

1 file changed

+28
-0
lines changed

content/develop/use/patterns/indexes/index.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,36 @@ Redis is not exactly a key-value store, since values can be complex data structu
1919

2020
This document explains how it is possible to create indexes in Redis using the following data structures:
2121

22+
* Hashes and JSON documents, using a variety of field types; used in conjunction with the Redis query engine.
2223
* Sorted sets to create secondary indexes by ID or other numerical fields.
2324
* Sorted sets with lexicographical ranges for creating more advanced secondary indexes, composite indexes and graph traversal indexes.
2425
* Sets for creating random indexes.
2526
* Lists for creating simple iterable indexes and last N items indexes.
27+
* Time series with labels.
2628

2729
Implementing and maintaining indexes with Redis is an advanced topic, so most
2830
users that need to perform complex queries on data should understand if they
2931
are better served by a relational store. However often, especially in caching
3032
scenarios, there is the explicit need to store indexed data into Redis in order to speedup common queries which require some form of indexing in order to be executed.
3133

34+
## Hashes and JSON indexes
35+
36+
The Redis query engine provides capabilities to index and query both hash and JSON data using a variety of field types:
37+
38+
* `TEXT`
39+
* `TAG`
40+
* `NUMERIC`
41+
* `GEO`
42+
* `VECTOR`
43+
* `GEOSHAPE`
44+
45+
Once data has been indexed using the [`FT.CREATE`]({{< baseurl >}}/commands/ft.create) command, it can be queried using the [`FT.SEARCH`]({{< baseurl >}}/commands/ft.search) and [`FT.AGGREGATE`]({{< baseurl >}}/commands/ft.aggregate) commands.
46+
47+
For more information on creating hash and JSON indexes, see the following pages.
48+
49+
* [Hash indexes]({{< relref "/develop/interact/search-and-query/basic-constructs/schema-definition" >}})
50+
* [JSON indexes]({{< relref "/develop/interact/search-and-query/indexing" >}})
51+
3252
## Simple numerical indexes with sorted sets
3353

3454
The simplest secondary index you can create with Redis is by using the
@@ -158,6 +178,14 @@ When representing much larger numbers, you need a different form of indexing
158178
that is able to index numbers at any precision, called a lexicographical
159179
index.
160180

181+
## Time series indexes
182+
183+
When you create a new time series using the [`TS.CREATE`]({{< baseurl >}}/commands/ts.create) command, you can associate one or more `LABELS` with it. Each label is a name-value pair, where the value can either be text or numeric. Labels serve as a secondary index that you can query using various time series commands.
184+
185+
See the [time series quickstart guide]({{< relref "/develop/data-types/timeseries/quickstart#labels" >}}) for an example of creating a time series with a label.
186+
187+
The [`TS.MGET`]({{< baseurl >}}/commands/ts.mget), [`TS.MRANGE`]({{< baseurl >}}/commands/ts.mrange), and [`TS.MREVRANGE`]({{< baseurl >}}/commands/ts.mrevrange) commands operate on multiple time series based on specified labels or using a label-related filter expression. The [`TS.QUERYINDEX`]({{< baseurl >}}/commands/ts.queryindex) command returns all time series keys matching a given label-related filter expression.
188+
161189
## Lexicographical indexes
162190

163191
Redis sorted sets have an interesting property. When elements are added

0 commit comments

Comments
 (0)