Skill 2.3.2

Implement vector indexing to enable similarity search

Key Concepts

FT.CREATE defines an index over keys with a prefix, for hashes or JSON documents, with a schema that includes a VECTOR field. The field names an algorithm (FLAT for exact search, HNSW for approximate search on larger sets), a TYPE such as FLOAT32, the DIM of the embeddings and a DISTANCE_METRIC of COSINE, L2 or IP. Other fields, such as TAG and NUMERIC fields, support filtering.

A query uses FT.SEARCH with a KNN clause, such as (@tenant:{contoso})=>[KNN 5 @embedding $vec AS score], passing the query vector as bytes in PARAMS and requiring query dialect 2. RediSearch must be selected when the cache is created, needs the Enterprise clustering policy and the NoEviction policy, and is not available on the Flash Optimized tier.