·
Last changedVersion:
This version passed the hardening gate. Hardening applied 14 targeted changes and preserved all other text. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 1. Review findings closed: 10. Review findings remaining: 3.
None
None
Expand | File | Group | Subtype | Severity | Status |
|---|
No findings available
0 findings
Guidance for using the Redis Query Engine (RQE) to index and search Hash or JSON documents. Covers schema design with FT.CREATE, field-type choices, query syntax, index lifecycle management, and the most common performance pitfalls.
FT.CREATE, FT.ALTER).FT.SEARCH / FT.AGGREGATE queries.TEXT, TAG, NUMERIC, GEO, GEOSHAPE, or VECTOR for a field.DIALECT 2 is the baseline. Other dialects (1, 3, 4) are deprecated as of Redis 8. Most modern client libraries already default to it — but specify it explicitly in raw commands for portability.
DIALECT 2 is required for vector search queries. It also handles special characters and NULLs predictably.
When connecting to Redis, use an encrypted connection, read credentials from the environment or a secrets store, use a database user limited to the commands and key prefixes the task needs, and keep passwords out of commands and output.
The field type decides both what you can query and how fast that query is. Use the narrowest type that supports your access pattern.
| Field type | Use when | Notes |
|---|---|---|
| Full-text search needed | Tokenized + stemmed; not for exact match |
| Exact match / filtering | Add |
| Range queries, sorting | Prices, counts, timestamps |
| Lat/long point queries | Single points (stores, users) |
| Polygon / area queries | Delivery zones, regions |
| Similarity search | HNSW or FLAT; see redis-vector-search |
The classic mistake is using TEXT for a category or status field because "it's a string." TAG is typically much faster and more accurate for exact match filters.
See references/field-types.md.
FT.CREATE without a PREFIX indexes every matching key in the database; with a wide schema it can blow up index size and write latency.
Rules of thumb:
PREFIX (or filter via FILTER expression).FT.INFO idx:<name> to monitor index size after adding fields.SORTABLE only on fields you actually sort by; it has a memory cost.FT.INFO while indexing runs.See references/index-creation.md.
For schema changes in production, keep application queries pointed at an alias and swap the underlying index.
Useful management commands: FT.INFO, FT.DROPINDEX, FT._LIST, FT.ALIASADD/UPDATE/DEL.
FT.DROPINDEX with its delete documents option removes every indexed key, not just the index. Get explicit user confirmation of the exact index or alias name before dropping an index or deleting an alias in production, and drop an old index only after the new one is verified, keeping its documents in place.
See references/index-management.md.
By default FT.CREATE walks all existing keys that match the prefix and indexes them. Use SKIPINITIALSCAN only when:
For most schema migrations, the default (scan everything) is what you want.
The initial scan runs in the background, and progress is visible in FT.INFO. With SKIPINITIALSCAN, existing keys stay unsearchable until they are rewritten, so confirm with the user that historical documents need not be searchable before using it.
See references/skip-initial-scan.md.
*Narrow the result set with filters before paging or aggregating.
Other levers:
SORTBY requires SORTABLE on the sort field. Without it, sort is slow.LIMIT bounds the returned results and response size, while filters narrow the work done; large offsets add cost, so use small page sizes.RETURN specific fields — don't fetch the whole document if you only need a few.FT.PROFILE idx:<name> SEARCH QUERY "<query>" when a query is slow.FT.INFO, FT._LIST or FT.PROFILE output, summarize only the relevant fields and leave out full schemas, prefixes or query text that may hold sensitive values.Treat user supplied values as untrusted: pass them as query parameters with DIALECT 2 rather than joining them into the query string, escape special characters (punctuation, spaces, braces, pipes, dashes, at signs) in TAG and TEXT values that cannot be passed as parameters, and enforce tenant and authorization filters in server code rather than in user controlled query text.
See references/query-optimization.md.
Get started with chainctlchainctl skill install public/redis/redis-query-engine:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.cgr.dev/public/github.com/redis/skills/redis-query-engine:latest
MIT
.cursor-plugin/plugin.json
HARDENING.md
LICENSE
SKILL.md
references/dialect.md
references/field-types.md
references/index-creation.md
references/index-management.md
references/query-optimization.md
references/skip-initial-scan.md