Redis Search 2.x no longer expects applications to write data using FT.ADD or FT.DEL.
All client write paths should use native Redis commands such as HSET, JSON.SET, and DEL or UNLINK. Indexing is applied automatically based on the index definition, including data type and key prefixes.
If your application previously wrapped FT.ADD or FT.DEL, or relied on custom Redis Search write helpers, those paths must be updated. Ensure your index is created with the correct data type and prefixes, for example:
FT.CREATE ... ON HASH PREFIX 1 user:FT.CREATE ... ON JSON PREFIX 1 user:
Writes are indexed only if they match the index definition.
This guide provides drop-in migration patterns for Go-Redis, Lettuce (Java), and Node-Redis.
Go-Redis
Before
client.Do(ctx, "FT.ADD", "idx", "user:1", 1, "FIELDS", "name", "Alice", "age", 30)
After
client.HSet(ctx, "user:1", map[string]interface{}{
"name": "Alice",
"age": 30,
})Delete
client.Del(ctx, "user:1")
Lettuce (Java)
Before
cmd.ftAdd("idx", "user:1", 1, Field.text("name", "Alice"));After
redis.hset("user:1", Map.of("name", "Alice", "age", "30"));Delete
redis.del("user:1");Node-Redis
Before
await client.sendCommand(["FT.ADD", "idx", "user:1", "1", "FIELDS", "name", "Alice"]);
After
await client.hSet("user:1", { name: "Alice", age: "30" });Delete
await client.del("user:1");Avoiding Double-Writes and Index Desync
| Problem | When this happens | What to check | How to fix |
|---|---|---|---|
Double-writing FT.ADD and HSET
|
Mixed services deployed during rollout | Multiple write paths active across services | Enforce a single write path at deploy time |
| Writes routed to different DB versions | Mixed Redis 7.x and 8.x topology | Redis version each service writes to | Use a per-database version flag to choose write method |
Old consumer still issuing FT.DEL
|
Staggered rollout | Legacy services still calling Search write commands | Validate all services are upgraded before enabling new schema |
| Missing index updates |
HASH: JSON: |
Index definition vs actual write payload | Review schema and validate writes using FT.INFO
|
0 comments
Please sign in to leave a comment.