← RedisCONTENT HISTORY

Update to Redis

Snapshot Sep 30, 2026 · 23:01 UTC · version 1.4.0

Collection source: not recorded for this historical snapshot.

WHAT CHANGED · RULE-BASED ANALYSIS

First saved snapshot

No earlier snapshot is available to establish a change.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "description": "Redis Search guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, JSON path), DIALECT 2 query syntax, FT.SEARCH / FT.AGGREGATE / FT.HYBRID command selection, vector similarity with HNSW or FLAT, hybrid retrieval combining lexical and vector ranking, RAG pipelines, zero-downtime index updates via aliases, and debugging with FT.PROFILE and FT.EXPLAIN. Use when defining a search index on Hash or JSON documents, writing FT.SEARCH queries with filters, sorting, aggregation, or vector KNN, tuning HNSW parameters, building a RAG retrieval pipeline, or troubleshooting slow or empty search results.",
  "included_files": [
    {
      "relative_path": "agents/openai.yaml",
      "size_in_bytes": 222
    },
    {
      "relative_path": "references/aggregate-cursors.md",
      "size_in_bytes": 3994
    },
    {
      "relative_path": "references/aggregate-pipeline.md",
      "size_in_bytes": 15396
    },
    {
      "relative_path": "references/algorithm-choice.md",
      "size_in_bytes": 4108
    },
    {
      "relative_path": "references/clients/java-jedis.md",
      "size_in_bytes": 51195
    },
    {
      "relative_path": "references/clients/python-redis-py.md",
      "size_in_bytes": 34638
    },
    {
      "relative_path": "references/clients/python-redisvl.md",
      "size_in_bytes": 50257
    },
    {
      "relative_path": "references/command-selection.md",
      "size_in_bytes": 9438
    },
    {
      "relative_path": "references/debugging.md",
      "size_in_bytes": 4732
    },
    {
      "relative_path": "references/dialect.md",
      "size_in_bytes": 2659
    },
    {
      "relative_path": "references/field-types.md",
      "size_in_bytes": 3776
    },
    {
      "relative_path": "references/ft-create-options.md",
      "size_in_bytes": 6354
    },
    {
      "relative_path": "references/hybrid-search.md",
      "size_in_bytes": 5131
    },
    {
      "relative_path": "references/index-creation.md",
      "size_in_bytes": 7043
    },
    {
      "relative_path": "references/index-management.md",
      "size_in_bytes": 3984
    },
    {
      "relative_path": "references/json-indexing.md",
      "size_in_bytes": 6314
    },
    {
      "relative_path": "references/query-optimization.md",
      "size_in_bytes": 3974
    },
    {
      "relative_path": "references/query-syntax.md",
      "size_in_bytes": 9898
    },
    {
      "relative_path": "references/rag-pattern.md",
      "size_in_bytes": 5194
    },
    {
      "relative_path": "references/result-shaping.md",
      "size_in_bytes": 6038
    },
    {
      "relative_path": "references/search-syntax-primitives.md",
      "size_in_bytes": 6710
    },
    {
      "relative_path": "references/text-tokenization.md",
      "size_in_bytes": 4947
    },
    {
      "relative_path": "references/vector-query.md",
      "size_in_bytes": 4786
    }
  ],
  "name": "redis-search",
  "skill_md_contents": "---\nname: redis-search\ndescription: Redis Search guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, JSON path), DIALECT 2 query syntax, FT.SEARCH / FT.AGGREGATE / FT.HYBRID command selection, vector similarity with HNSW or FLAT, hybrid retrieval combining lexical and vector ranking, RAG pipelines, zero-downtime index updates via aliases, and debugging with FT.PROFILE and FT.EXPLAIN. Use when defining a search index on Hash or JSON documents, writing FT.SEARCH queries with filters, sorting, aggregation, or vector KNN, tuning HNSW parameters, building a RAG retrieval pipeline, or troubleshooting slow or empty search results.\nlicense: MIT\n---\n\n# Redis Search\n\nSingle source of guidance for Redis Search — the retrieval surface that spans lexical, numeric, geo, JSON-path, and vector queries. Vector fields are part of the same `FT.CREATE` machinery as TEXT/TAG/NUMERIC fields, and `FT.HYBRID` blends lexical and vector ranking in one command, so this skill covers them together.\n\n## When to apply\n\n- Creating, modifying, or reviewing a Redis Search index (`FT.CREATE`, `FT.ALTER`).\n- Writing or optimizing `FT.SEARCH`, `FT.AGGREGATE`, or `FT.HYBRID` queries.\n- Picking between `TEXT`, `TAG`, `NUMERIC`, `GEO`, `GEOSHAPE`, `VECTOR`, or JSON-path fields.\n- Defining a `VECTOR` field, choosing HNSW vs FLAT, tuning HNSW parameters.\n- Building a retrieval-augmented generation (RAG) pipeline.\n- Rolling out a new index schema without downtime.\n- Troubleshooting empty results, slow queries, or tokenization issues with `FT.EXPLAIN`, `FT.PROFILE`, `FT.INFO`.\n\n## 1. Pick the right command\n\nThree query commands. Reach for the narrowest one that fits.\n\n| Command | When to use | Mental model | Minimum Redis |\n|---|---|---|---|\n| **FT.SEARCH** | Document retrieval, ranked or sorted. Best default. | Returns matching docs directly. | 2.0 (module) / 8.0 (built-in) |\n| **FT.AGGREGATE** | Faceting, computed fields, custom output shape, analytics. | Declarative pipeline: `LOAD`, `APPLY`, `GROUPBY`, `REDUCE`, `SORTBY`. | 2.0 / 8.0 |\n| **FT.HYBRID** | Blend lexical (BM25) with vector similarity, with configurable fusion. | Pipeline with explicit `SEARCH` + `VSIM` legs and a `COMBINE` fusion stage. | **8.4.0** |\n\n```\n# FT.SEARCH — most common\nFT.SEARCH idx:products \"@category:{electronics} @price:[100 500]\" LIMIT 0 20 RETURN 3 name price category\n\n# FT.AGGREGATE — top categories by avg price\nFT.AGGREGATE idx:products \"*\" GROUPBY 1 @category REDUCE AVG 1 @price AS avg_price SORTBY 2 @avg_price DESC\n\n# FT.HYBRID (Redis ≥ 8.4) — lexical + vector fusion\nFT.HYBRID idx:docs\n  SEARCH \"@title:transformers\" SCORER BM25 YIELD_SCORE_AS lexscore\n  VSIM embedding $vec KNN count 1 K 50 YIELD_SCORE_AS vecscore\n  COMBINE RRF 2 CONSTANT 60\n  PARAMS 2 vec \"...\"\n  DIALECT 2\n```\n\nFor Redis < 8.4 the lexical+vector blend is approximated with `FT.SEARCH` pre-filter + `=>[KNN ...]`. See [references/command-selection.md](references/command-selection.md) and [references/hybrid-search.md](references/hybrid-search.md).\n\n## 2. Schema basics — `FT.CREATE`\n\n`FT.CREATE` indexes Hash or JSON documents matching a `PREFIX`. Always set `PREFIX`. Use `DIALECT 2` (the default since Redis 8; required for vector queries).\n\n```\nFT.CREATE idx:products ON HASH PREFIX 1 product:\n    SCHEMA\n        name TEXT WEIGHT 2.0\n        category TAG SORTABLE\n        price NUMERIC SORTABLE\n        location GEO\n        embedding VECTOR HNSW 6\n            TYPE FLOAT32\n            DIM 1536\n            DISTANCE_METRIC COSINE\n```\n\nPick the narrowest field type that supports your access pattern:\n\n| Field type | Use when | Notes |\n|---|---|---|\n| `TEXT` | Full-text search | Tokenized + stemmed; **not** for exact match |\n| `TAG` | Exact match / filtering | Add `SORTABLE UNF` for fastest tag queries |\n| `NUMERIC` | Range queries, sorting | Prices, counts, timestamps |\n| `GEO` | Lat/long points | Stores, users |\n| `GEOSHAPE` | Polygon / area queries | Delivery zones, regions |\n| `VECTOR` | Similarity search | HNSW or FLAT; see §4 |\n| JSON `$.path AS alias` | Nested JSON fields | `ON JSON`; see [references/json-indexing.md](references/json-indexing.md) |\n\nThe classic mistake is `TEXT` for a category or status field \"because it's a string\" — `TAG` is roughly 10× faster for exact-match filtering.\n\nSee [references/index-creation.md](references/index-creation.md), [references/field-types.md](references/field-types.md), [references/dialect.md](references/dialect.md), [references/ft-create-options.md](references/ft-create-options.md), [references/json-indexing.md](references/json-indexing.md).\n\n## 3. Common queries\n\nNarrow with filters; return only what you need.\n\n```\n# Tag filter + numeric range, sorted by price\nFT.SEARCH idx:products \"@category:{electronics} @price:[100 500]\"\n    SORTBY price ASC\n    LIMIT 0 20\n    RETURN 3 name price category\n\n# Text + tag filter\nFT.SEARCH idx:products \"wireless headphones @category:{audio}\"\n\n# Negation and OR\nFT.SEARCH idx:products \"@category:{audio} -@brand:{generic} (@price:[0 100] | @on_sale:{true})\"\n```\n\nOperators worth remembering: space = AND, `|` = OR, `-` = NOT, `~` = optional (scoring boost), `=>{$weight: N}` = boost. Escape hyphens and special characters inside TAG values (`@sku:{ABC\\\\-123}`). See [references/query-syntax.md](references/query-syntax.md) and [references/search-syntax-primitives.md](references/search-syntax-primitives.md) for the DSL vocabulary.\n\nFor tokenization gotchas (stemming, stopwords, language) see [references/text-tokenization.md](references/text-tokenization.md). For result shaping (`SORTBY`, `RETURN`, `HIGHLIGHT`, `SUMMARIZE`, `NOCONTENT`) see [references/result-shaping.md](references/result-shaping.md). For performance levers (pre-filters, `SORTABLE` fields, tight `RETURN`, `FT.PROFILE`) see [references/query-optimization.md](references/query-optimization.md).\n\n## 4. Vector basics\n\nThree vector settings have to match the embedding model exactly:\n\n- **`DIM`** — output dimensionality (e.g. 1536 for OpenAI `text-embedding-3-small`). Mismatch produces silent garbage.\n- **`DISTANCE_METRIC`** — `COSINE` for normalized text embeddings (common case), `IP` for unnormalized inner-product, `L2` for raw Euclidean.\n- **`TYPE`** — usually `FLOAT32`. Use `FLOAT16` or quantized variants only when memory is the binding constraint.\n\n```\n# Index\nFT.CREATE idx:docs ON HASH PREFIX 1 doc:\n    SCHEMA\n        content TEXT\n        embedding VECTOR HNSW 6 TYPE FLOAT32 DIM 1536 DISTANCE_METRIC COSINE\n\n# Pure KNN query (top 5 by cosine similarity)\nFT.SEARCH idx:docs \"*=>[KNN 5 @embedding $vec AS score]\"\n    PARAMS 2 vec \"...\"\n    SORTBY score\n    DIALECT 2\n```\n\n| Algorithm | Speed | Accuracy | Memory | Use for |\n|---|---|---|---|---|\n| **HNSW** | Fast (approximate) | ~95%+ recall (tunable) | Higher | Production: >10k vectors, latency-sensitive |\n| **FLAT** | Slow (exact) | 100% | Lower | Small corpora (<10k), exact-match required |\n\nHNSW tuning levers: `M` (16–64, connections per node), `EF_CONSTRUCTION` (100–500, build quality), `EF_RUNTIME` (query-time candidate list).\n\nSee [references/vector-query.md](references/vector-query.md), [references/algorithm-choice.md](references/algorithm-choice.md).\n\n## 5. Hybrid retrieval\n\nTwo distinct patterns get called \"hybrid.\" Pick by intent.\n\n**Filter-then-vector** (any Redis version) — apply attribute filters so the engine narrows the search space *before* the vector comparison.\n\n```\nFT.SEARCH idx:docs \"(@category:{tech} @date:[2024 +inf])=>[KNN 10 @embedding $vec AS score]\"\n    PARAMS 2 vec \"...\"\n    SORTBY score\n    DIALECT 2\n```\n\n**Lexical + vector fusion** (Redis ≥ 8.4) — blend BM25 text scoring with vector similarity, fuse with `RRF` or `LINEAR`. Use `FT.HYBRID` (see §1).\n\nDon't fetch a wide unfiltered result and filter client-side — slower and less accurate. See [references/hybrid-search.md](references/hybrid-search.md).\n\n## 6. Aggregations and shaping\n\n`FT.AGGREGATE` is the declarative result-shaping command. Build a pipeline of stages.\n\n```\n# Top 5 categories by total revenue\nFT.AGGREGATE idx:orders \"@status:{shipped}\"\n    LOAD 2 @category @amount\n    GROUPBY 1 @category\n        REDUCE SUM 1 @amount AS revenue\n    SORTBY 2 @revenue DESC\n    LIMIT 0 5\n```\n\nCommon stages: `LOAD`, `APPLY` (computed fields), `FILTER` (post-query), `GROUPBY` + `REDUCE` (`SUM`, `COUNT`, `AVG`, `FIRST_VALUE`, `TOLIST`), `SORTBY`, `LIMIT`.\n\nFor long-running result sets use `WITHCURSOR` + `FT.CURSOR READ` to page server-side. See [references/aggregate-pipeline.md](references/aggregate-pipeline.md) and [references/aggregate-cursors.md](references/aggregate-cursors.md).\n\n## 7. RAG pattern\n\nStandard pipeline: embed the query, vector-search Redis, pass top-K context to the LLM.\n\nPractical tips:\n\n- **Match the metric** to the embedding model (almost always `COSINE` for normalized text models).\n- **Chunk long documents** (200–500-token chunks usually beat indexing whole pages).\n- **Batch inserts** rather than one call per record.\n- **Pre-filter with attributes** (tenant, recency, document type) before the vector search — see §5.\n- **Re-rank** at the top of the funnel if precision matters more than recall.\n\nSee [references/rag-pattern.md](references/rag-pattern.md).\n\n## 8. Operations\n\nZero-downtime schema changes: keep app queries pointed at an alias and swap the underlying index.\n\n```\nFT.CREATE idx:products_v2 ON HASH PREFIX 1 product: SCHEMA ...\nFT.ALIASUPDATE products idx:products_v2\n# App queries are stable:\nFT.SEARCH products \"@category:{electronics}\"\n```\n\nUseful management commands: `FT.INFO`, `FT.DROPINDEX`, `FT._LIST`, `FT.ALIASADD/UPDATE/DEL`. See [references/index-management.md](references/index-management.md).\n\nDebug empty or slow queries with `FT.EXPLAIN` (shows how the query was parsed) and `FT.PROFILE` (shows execution stats). See [references/debugging.md](references/debugging.md).\n\n## 9. Client examples\n\nInline examples in this SKILL.md are CLI / RESP form — the wire protocol every client serializes to. For idiomatic snippets in a specific client:\n\n- **redis-py** (Python, raw client): [references/clients/python-redis-py.md](references/clients/python-redis-py.md)\n- **Jedis** (Java): [references/clients/java-jedis.md](references/clients/java-jedis.md)\n- **RedisVL** (Python, higher-level SDK on top of redis-py): [references/clients/python-redisvl.md](references/clients/python-redisvl.md)\n\nOther clients (Lettuce, node-redis, go-redis, NRedisStack, .NET) translate the same CLI form; coverage is tracked as a follow-up.\n\n## References\n\n- [Redis: Search and query](https://redis.io/docs/latest/develop/interact/search-and-query/)\n- [Redis: Vectors](https://redis.io/docs/latest/develop/ai/search-and-query/vectors/)\n- [Redis: Query syntax](https://redis.io/docs/latest/develop/interact/search-and-query/query/)\n- [Redis: Query dialects](https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/)\n- [Redis: RAG quickstart](https://redis.io/docs/latest/develop/get-started/rag/)\n- [FT.CREATE](https://redis.io/docs/latest/commands/ft.create/) · [FT.SEARCH](https://redis.io/docs/latest/commands/ft.search/) · [FT.AGGREGATE](https://redis.io/docs/latest/commands/ft.aggregate/) · [FT.HYBRID](https://redis.io/docs/latest/commands/ft.hybrid/)\n- [RedisVL documentation](https://docs.redisvl.com/en/latest/)\n"
}

SHA-256 of public snapshot: ff0ad208f3003a4b97c175ba2ef3c93c64d93f121c2bbc76399985a45315949f