In Redis Open Source 8 and later, Redis Search automatically indexes JSON and Hash documents as you write or update data.
If documents don’t appear in search results or indexes seem incomplete, the issue is usually related to asynchronous indexing, schema mismatches, or cluster configuration.
This guide helps you identify and fix incomplete or inconsistent indexing, including verification commands, cleanup steps, and best practices.
(For Redis 7.x users, the same behavior applies when using Redis Stack.)
Covered:
How Indexing Works
Redis indexes documents automatically when keys match the prefix and field types defined in an index schema.
Index lifecycle
Stage |
Description |
|---|---|
Index creation |
Define indexed fields and prefixes with |
Document addition |
Add or update data with |
Synchronous indexing |
New or modified documents are indexed immediately. |
Asynchronous indexing |
Existing data at the time of index creation is processed in the background. |
Monitoring progress |
Use |
Quick Verification Commands
Run these quick checks to confirm index status (the first command returns a list of indexes that can be passed to the later commands):
FT._LIST FT.INFO <index> | grep indexing FT.INFO <index> | grep hash_indexing_failures FT.SEARCH <index> "*" LIMIT 0 10
Field |
Ideal Value |
Meaning |
|---|---|---|
|
0 |
Background indexing complete |
|
1 |
All documents processed |
|
0 |
No documents skipped |
Common Causes of Missing or Incomplete Indexing
Asynchronous indexing not finished
Index creation triggers background indexing for existing data. Searches may appear incomplete until finished.Schema or data type mismatch
Mismatched field types (for example, string in a NUMERIC field) cause indexing failures.Incorrect prefix
Keys not matching thePREFIXvalue inFT.CREATEare ignored.OSS Cluster API limitation
Redis Search isn't supported on sharded databases using the OSS Cluster API. Indexes may appear only on certain nodes.Partial deletions
FT.DROPINDEX <index> DDdeletes only successfully indexed documents. Others remain until cleaned up manually.Timeouts or load
Large or busy datasets can delay indexing or cause it to stall.Frequent updates (high churn)
Heavy write activity can cause fragmentation and delayed index consistency.-
Missing data after index creation
In index created with the optionSKIPINITIALSCANduringFT.CREATEwill not index any existing keys in the database, only new keys added/modified after the index creation.
Step-by-Step Troubleshooting
1. Check Index Status
FT.INFO <index>
Confirm:
indexing: 0→ Indexing completepercent_indexed: 1→ 100 % coveragehash_indexing_failures: 0→ No skipped records
If indexing is still active, wait until it completes or resolves any memory or CPU bottlenecks.
2. Investigate Indexing Failures
If hash_indexing_failures > 0:
Review affected documents for data type mismatches.
Correct or remove invalid entries.
Rebuild the index if failures persist.
3. Validate Prefix and Schema
Ensure the prefix in
FT.CREATEmatches your document keys (user:vsusers:).Confirm the schema field types align with stored values.
Example: NUMERIC fields must contain integers or floats, not strings.
4. Check for Leftover or Unindexed Keys
After dropping an index with DD, scan for remaining keys:
SCAN 0 MATCH <prefix>:* COUNT 1000
Safely delete them using non-blocking cleanup:
redis-cli --scan --pattern "<prefix>:*" | xargs redis-cli UNLINK
5. When to Rebuild an Index
Recreate the index only if:
Indexing failures persist after fixing data
Schema fields or types were changed
Modules were not loaded when the index was first created
Index was inadvertently created with
SKIPINITIALSCAN
FT.DROPINDEX <index> DD FT.CREATE <index> ...
6. Cluster Limitations and OSS Cluster API Behavior
Redis Search is not supported for sharded databases under the OSS Cluster API.
To use search and query:
Disable OSS Cluster API and use a proxy-based setup
Limit search to single-shard environments only for testing
7. Monitor High-Churn Environments
Frequent updates can cause index bloat and slow queries.
Tune garbage-collection parameters to improve performance:
FORK_GC_RUN_INTERVAL FORK_GC_CLEAN_THRESHOLD
Separate frequently updated data from indexed (read-heavy) data whenever possible.
Best Practices
Wait for indexing to finish before deleting or rebuilding indexes.
Monitor
hash_indexing_failuresregularly to catch schema drift early.Use consistent prefixes to simplify lifecycle management.
Use
UNLINKinstead ofDELfor non-blocking cleanup.Avoid OSS Cluster API for Redis Search in production.
Use aliasing or versioning for zero-downtime schema changes.
Monitor performance with
FT.INFO,FT.PROFILE, and memory stats.
Common Issues and Solutions
Issue |
Cause / Explanation |
Solution / Action |
|---|---|---|
Index incomplete or missing |
Asynchronous indexing still running |
Wait for |
Some documents not indexed |
Schema/type mismatch |
Check |
|
Only indexed docs removed |
Clean up with |
Index inconsistent across nodes |
Redis Search unsupported in sharded OSS Cluster |
Disable OSS Cluster API or use proxy |
Slow queries or large index size |
High update churn |
Tune GC parameters; separate hot/cold data |
Index stuck or partial |
Resource limits or node instability |
Check memory, rebuild after cluster health validation |
0 comments
Please sign in to leave a comment.