Secondary indexing and querying for Upstash Redis
@upstash/query
offers secondary indexing and search capabilities for Upstash Redis. It is fully managed by Upstash and scales automatically.
Install dependencies
Set environment variables
Import the packages and create a client
Define a type for your data
Create a collection of the same type and an index on the collection
It’s important to declare indices before you start adding data to your collection. Otherwise, they will not be indexed.
In cases where you want to add an index to an existing collection, you can use the .reIndex()
method.
Time to add some data
Run your first query against the index
Secondary indexing and querying for Upstash Redis
@upstash/query
offers secondary indexing and search capabilities for Upstash Redis. It is fully managed by Upstash and scales automatically.
Install dependencies
Set environment variables
Import the packages and create a client
Define a type for your data
Create a collection of the same type and an index on the collection
It’s important to declare indices before you start adding data to your collection. Otherwise, they will not be indexed.
In cases where you want to add an index to an existing collection, you can use the .reIndex()
method.
Time to add some data
Run your first query against the index