hybrid_search
Filter documents by metadata before ranking by vector similarity to enable production RAG and semantic search pipelines.
Instructions
Perform a hybrid search combining a Redis filter expression with KNN vector similarity.
Hybrid search pre-filters documents by metadata before ranking by vector similarity — the standard pattern for production RAG and semantic search pipelines.
Filter expression examples: "*" → no filter, pure vector search (same as vector_search_hash) "@category:{news}" → tag filter "@year:[2020 2024]" → numeric range "@lang:{en} @year:[2022 +inf]" → combined tag + range "@title:redis" → full-text match on a text field
Full filter syntax: https://redis.io/docs/latest/develop/interact/search-and-query/query/
Args: query_vector: List of floats to use as the query vector. filter_expression: Redis filter expression to restrict candidates before KNN ranking. Defaults to '*' (no filter). index_name: Name of the Redis index (default: 'vector_index'). vector_field: Name of the indexed vector field (default: 'vector'). k: Number of nearest neighbors to return. return_fields: Additional fields to include in results (optional).
Returns: A list of matched documents with their similarity score, or an error message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query_vector | Yes | ||
| filter_expression | No | * | |
| index_name | No | vector_index | |
| vector_field | No | vector | |
| k | No | ||
| return_fields | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |