Redis › RedisSearch (Full Text Search)

How do you create a search index in RedisSearch, and what does defining a schema for that index actually do?

Beginner

Answer

You use the FT.CREATE command, specifying which keys to index based on a prefix pattern and defining a schema that maps specific fields within your data to search field types like TEXT for full text searchable content, NUMERIC for range queries, or TAG for exact match filtering, telling RedisSearch exactly how to index and later let you query each field.
FT.CREATE product_idx ON HASH PREFIX 1 product: SCHEMA name TEXT price NUMERIC category TAG
Real-world example A product catalog defines a search index specifying that the name field should support full text search, the price field should support numeric range queries, and the category field should support exact tag based filtering.

Common follow-ups: What happens to existing data if you create an index after that data was already added?;Can you modify an existing index's schema later without recreating it?