Skip to main content

Build

Redis Query Engine

RedisOfficialCertified

We earn commissions when you shop through the links below.

Redis Query Engine (RQE) guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR), DIALECT 2 query syntax, efficient FT.SEARCH and FT.AGGREGATE queries, zero-downtime index updates via aliases, and the SKIPINITIALSCAN option. Use when defining a search index on Hash or JSON documents, picking between TEXT and TAG for filtering, writing FT.SEARCH queries with filters and SORTBY, managing or swapping indexes in production, or troubleshooting slow searches with FT.PROFILE.

  • New
  • v1.0.0
  • Reviewed Jul 21
  • No reviews yet

Capabilities

  • Use DIALECT 2 (the modern default)

    DIALECT 2 is the baseline

  • Pick the right field type

    The field type decides both what you can query and how fast that query…

  • Write specific queries, not *

    Narrow the result set with filters before paging or aggregating

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.0.0

Redis Query Engine

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.

When to apply

  • Creating, modifying, or reviewing an RQE index (FT.CREATE, FT.ALTER).
  • Writing or optimizing FT.SEARCH / FT.AGGREGATE queries.
  • Deciding between TEXT, TAG, NUMERIC, GEO, GEOSHAPE, or VECTOR for a field.
  • Rolling out a new index schema without downtime.
  • Spinning up an index that should only cover newly written keys.

1. Use DIALECT 2 (the modern default)

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.

text
FT.SEARCH idx:products "@name:laptop" DIALECT 2

DIALECT 2 is required for vector search queries. It also handles special characters and NULLs predictably.

See references/dialect.md.

2. Pick the right field type

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
TEXT Full-text search needed Tokenized + stemmed; not for exact match
TAG Exact match / filtering Add SORTABLE UNF for fastest tag queries
NUMERIC Range queries, sorting Prices, counts, timestamps
GEO Lat/long point queries Single points (stores, users)
GEOSHAPE Polygon / area queries Delivery zones, regions
VECTOR 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 10× faster for those.

See references/field-types.md.

3. Index only what you query — and always set a prefix

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.

text
FT.CREATE idx:products ON HASH PREFIX 1 product:
    SCHEMA
        name TEXT WEIGHT 2.0
        category TAG SORTABLE
        price NUMERIC SORTABLE
        location GEO

Rules of thumb:

  • Start with the minimum schema. Add fields as new query patterns emerge.
  • Always set PREFIX (or filter via FILTER expression).
  • Use FT.INFO idx:<name> to monitor index size after adding fields.
  • Use SORTABLE only on fields you actually sort by; it has a memory cost.

See references/index-creation.md.

4. Zero-downtime index updates — use aliases

For schema changes in production, keep application queries pointed at an alias and swap the underlying index.

text
FT.CREATE idx:products_v2 ON HASH PREFIX 1 product: SCHEMA ...
FT.ALIASUPDATE products idx:products_v2

# App queries are stable:
FT.SEARCH products "@category:{electronics}"

Useful management commands: FT.INFO, FT.DROPINDEX, FT._LIST, FT.ALIASADD/UPDATE/DEL.

See references/index-management.md.

5. SKIPINITIALSCAN — only when historical data is irrelevant

By default FT.CREATE walks all existing keys that match the prefix and indexes them. Use SKIPINITIALSCAN only when:

  • You're standing up the index for a new feature and existing data shouldn't be queryable.
  • Existing data is too large to scan synchronously.
  • You're indexing event streams where only future events matter.

For most schema migrations, the default (scan everything) is what you want.

See references/skip-initial-scan.md.

6. Write specific queries, not *

Narrow the result set with filters before paging or aggregating.

text
# Good — specific filter, limited fields returned
FT.SEARCH idx:products "@category:{electronics} @price:[100 500]"
    LIMIT 0 20
    RETURN 3 name price category
text
# Bad — full scan plus unbounded LIMIT
FT.SEARCH idx:products "*" LIMIT 0 10000

Other levers:

  • SORTBY requires SORTABLE on the sort field. Without it, sort is slow.
  • LIMIT early; the engine still processes everything above the limit if you don't.
  • RETURN specific fields — don't fetch the whole document if you only need a few.
  • Profile with FT.PROFILE idx:<name> SEARCH QUERY "<query>" when a query is slow.

See references/query-optimization.md.

References

  • Redis: Query Engine — Indexing
  • Redis: Query syntax
  • Redis: Query dialects
  • Redis: Administration (aliases, dropindex)
  • FT.CREATE

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from Redis

View source →
redis-observabilityRedis observability guidance — which metrics to monitor (memory, connections, hit ratio, ops/sec, rejected connections), which built-in commands to reach for during incident triage (SLOWLOG, INFO, MEMORY DOCTOR, CLIENT LIST, FT.PROFILE),…2 installsredis-vector-searchRedis vector search guidance covering HNSW vs FLAT algorithm choice, vector index configuration (dims, distance metric, datatype), filtered hybrid search combining vector similarity with TAG or NUMERIC filters, and the RAG retrieval…2 installsredis-coreCore Redis modeling guidance — choose the right data structure (String, Hash, List, Set, Sorted Set, JSON, Stream, Vector Set) and use consistent colon-separated key names. Use when designing a Redis data model, caching objects, deciding…2 installsredis-clusteringRedis Cluster and replication guidance covering hash tags for multi-key operations, avoiding CROSSSLOT errors, and reading from replicas to scale read-heavy workloads. Use when designing keys for a sharded Redis Cluster, debugging…2 installsadd-lensAdd Redis Iris Lens tracing to an existing AI agent through redis-iris, so every agent turn is one trace in the Lens UI with its LLM calls, tokens, tool calls, memory and document retrievals, and which of them entered the prompt. Detects…0 installsadd-redis-irisAdd Redis Iris to an existing AI agent in any framework (LangGraph, LangChain, OpenAI Agents SDK, Google ADK, Pydantic AI, CrewAI, or a plain loop). Use when the user asks to add Iris, Redis Agent Memory, Agent Playbooks, Context Gateway,…0 installs

Frequently asked questions about redis-query-engine

What does the redis-query-engine skill do?

Redis Query Engine (RQE) guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR), DIALECT 2 query syntax, efficient FT.SEARCH and FT.AGGREGATE queries, zero-downtime index updates via aliases, and the SKIPINITIALSCAN option. Use when defining a search index on Hash or JSON documents, picking between TEXT and TAG for filtering, writing FT.SEARCH queries with filters and SORTBY, managing or swapping indexes in production, or troubleshooting slow searches with FT.PROFILE. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the redis-query-engine skill?

Run `npx @skills-hub-ai/cli install redis-query-engine` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/redis-query-engine/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does redis-query-engine work with?

redis-query-engine runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the redis-query-engine skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use redis-query-engine after installing it?

In Claude Code, type `/redis-query-engine` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the redis-query-engine skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/redis-query-engine)](https://skills-hub.ai/skills/redis-query-engine)
HTML
<a href="https://skills-hub.ai/skills/redis-query-engine"><img src="https://skills-hub.ai/api/badges/skill/redis-query-engine" alt="Install on Skills Hub"></a>

More options in the badge docs.