Skip to main content
@upstash/query offers secondary indexing and search capabilities for Upstash Redis. It is fully managed by Upstash and scales automatically.

github.com/upstash/query

Features

  • E2E Typesafe: Fully typed API with TypeScript generics to offer the best developer experience.
  • Secondary Indexing: Create indexes on your data and query them with a simple API.
  • Range Queries: Query your data with range queries. Either numeric or lexicographic.

Quickstart

1

Install dependencies

2

Set environment variables

.env
3

Import the packages and create a client

4

Define a type for your data

5

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.
6

Time to add some data

7

Run your first query against the index