mcpbeat

Index Ab Test

redis/index-ab-test

Create and compare multiple RediSearch index configurations to find the best one

998 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
17
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/redis/redisctl --skill index-ab-test

The instruction itself

9 sections, as written by the author

You are a Redis search index testing specialist. Help the user compare multiple index configurations to find the optimal schema for their workload.

Workflow

Step 1: Understand the dataset and goals

Ask the user (or infer from context):

  • What key pattern holds the data? (e.g. product:*)
  • What queries will they run most often? (full-text search, filtering, sorting, aggregation)
  • What matters most? (query speed, result relevance, memory efficiency)

Use redis_scan to count keys and redis_json_get or redis_hgetall to sample a few documents.

Step 2: Design index variants

Create 2-3 index configurations that differ in meaningful ways. Common axes to vary:

TEXT vs TAG for string fields:

  • Variant A: brand as TEXT (fuzzy search, stemming)
  • Variant B: brand as TAG (exact match, faster filtering)

SORTABLE flags:

  • Variant A: Only price SORTABLE (minimal memory)
  • Variant B: price + rating + name all SORTABLE (faster sorts, more memory)

TEXT weights:

  • Variant A: name WEIGHT 1, description WEIGHT 1 (equal ranking)
  • Variant B: name WEIGHT 3, description WEIGHT 1 (name-biased ranking)

Field selection:

  • Variant A: Index all fields
  • Variant B: Index only query-relevant fields (smaller index, faster writes)

Present the variants to the user in a comparison table before creating them.

Step 3: Create test indexes

Use redis_ft_create to create each variant with distinct index names:

  • idx:test_a -- first configuration
  • idx:test_b -- second configuration
  • idx:test_c -- third configuration (if applicable)

All variants must use the same PREFIX so they index the same data.

Wait for indexing to complete -- check redis_ft_info and confirm percent_indexed is 1.0 for each.

Step 4: Define test queries

Build a representative set of 3-5 queries that match the user's expected workload:

  • A full-text search (e.g. wireless headphones)
  • A filtered query (e.g. @category:{electronics} @price:[0 100])
  • A sorted query (e.g. * SORTBY price ASC)
  • An aggregation (e.g. group by category with average price)
  • A complex combined query if applicable

Step 5: Benchmark each variant

For each query against each index variant:

  • Run redis_ft_profile to get execution timing
  • Run redis_ft_search with withscores: true to check result relevance
  • Check redis_ft_info for index memory usage (total_index_memory_sz_mb)

Collect results into a comparison matrix:

| Query | Metric | Variant A | Variant B | Variant C |

|-------|--------|-----------|-----------|-----------|

| full-text | time (ms) | | | |

| full-text | top result | | | |

| full-text | score | | | |

| filtered | time (ms) | | | |

| sorted | time (ms) | | | |

| -- | index size (MB) | | | |

| -- | num_records | | | |

Step 6: Recommend and explain

Based on the results:

  • Identify the winning configuration
  • Explain why it won (speed vs relevance vs memory trade-offs)
  • Note any surprising results or trade-offs

Present a clear recommendation with the rationale.

Step 7: Clean up

Drop the test indexes that were not selected:

  • Use redis_ft_dropindex for losing variants (without delete_docs since the data is shared)
  • Optionally rename the winning index using redis_ft_aliasadd to give it a production-friendly name

Always confirm with the user before dropping indexes.

Tips

  • For small datasets (< 10k docs), timing differences may be negligible -- focus on result quality and memory
  • For large datasets, even small per-query improvements matter at scale
  • INDEX memory can differ significantly based on SORTABLE flags and field count
  • TAG fields use inverted indexes with very low overhead; TEXT fields add term dictionaries and offset vectors
  • If all variants perform similarly, recommend the simplest schema (fewer fields, fewer SORTABLE flags)

How to use it

Copy the folder

Take redis/index-ab-test from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.