How stream indexes work
A stream index differs from a JSON, hash, or string index in two ways:- It is bound to one exact stream key instead of one or more key prefixes.
- Each stream entry is a document. The document ID returned by Search is the stream entry ID.
XADD provide the document fields. Stream
payloads are flat field-value pairs, so schema fields refer to stream fields rather than nested paths.
The stream does not need to exist when you create the index. Entries added later are indexed
automatically.
Create a stream index
UseON STREAM followed by the exact stream key. PREFIX is not supported for stream indexes.
SEARCH.DROP.
Add and search entries
Add entries with regular stream commands. The field names do not need to appear in the schema, but only schema fields are searchable.1-0 as its document ID. Without NOCONTENT, its content is returned as the
stream entry’s field-value pairs. All regular query features, including filtering, highlighting,
sorting, pagination, and score functions, use the fields declared in the schema.
Index updates are asynchronous. Use
SEARCH.WAITINDEXING when a query must include preceding
writes, especially in tests and setup scripts.Schema values
Redis stores stream field values as strings. Search converts each value according to its schema type:U64,I64, andF64fields require values in the corresponding numeric format.BOOLfields accepttrueorfalse.DATEfields require an RFC 3339 timestamp, such as2026-08-24T09:30:00Z.TEXT,KEYWORD, andFACETfields use string values.
FROM to expose a stream field under a different index field name:
description), while SELECT and returned content use the original
stream field name (message).
Existing entries and reindexing
Creating an index scans entries already present in the stream. UseSKIPINITIALSCAN to index only new
entries at first:
SEARCH.REINDEX later to rebuild the index from all
entries currently in the stream.
Entry deletion and trimming
The index follows the contents of the stream:
If a deleted or expired stream is recreated under the same key, new entries are added to the existing
index. Consumer-group operations that do not change entry data, such as
XACK, do not change the
index.
Next steps
- See Schema Definition for field types and options.
- See Querying and filtering for the JSON query syntax.
- See Aggregations to group and summarize stream entries.