VALKEY-SEARCH(7)
β¨ NAME β¨
valkey-search β literally Valkey Search, bestie π
π¦ VALKEY-SEARCH π¦
Valkey-Search (BSD-3-Clause), which gets handed to you as a Valkey module, is a high-performance Vector Similarity Search engine that is lowkey built for AI-driven workloads. It serves up single-digit millisecond latency and high QPS, and it can hold down billions of vectors with over 99% recall. No cap. π
Valkey-Search lets you create indexes and run similarity searches, and you can layer complex filters on top. It does Approximate Nearest Neighbor (ANN) search with HNSW, and exact matching with K-Nearest Neighbors (KNN). For your data, you index with either valkey-hashes(7) Valkey Hash or valkey-valkey-json(7) Valkey-JSON data types. Pick your fighter. π
Right now Valkey-Search is focused on Vector Search, but the goal is bigger: it wants to glow Valkey up into a full-fledged search engine, with full-text search and extra indexing options on the way. It's giving "we're just getting started." β¨
πΈ Use-Cases Where Valkey-Search Shines πΈ
Searching billions of vectors with millisecond latencies is exactly the vibe for real-time applications like:
- Personalized Recommendations β hand out instant, extremely relevant recommendations based on real-time user interactions.
- Fraud Detection & Security β catch anomalies and suspicious activity with ultra-fast similarity matching.
- Conversational AI & Chatbots β make responses more accurate and more relevant by leveraging rapid vector-based retrieval.
- Image & Video Search β enable multimedia search through real-time similarity detection.
- GenAI & Semantic Search β power advanced AI applications with efficient vector retrieval for natural language understanding.
π Supported Commands π
FT.CREATEFT.DROPINDEXFT.INFOFT._LISTFT.SEARCH
For the full tea β detailed descriptions of the supported commands, examples, and configuration options β see the valkey-commands(7) Command Reference.
π Scaling π
Valkey-Search works in both Standalone and Cluster modes, periodt. Query processing and ingestion scale linearly with CPU cores in both modes. And if you have big storage requirements, you can use Cluster mode to horizontally scale the keyspace.
If replica lag is acceptable to you, you can also get horizontal query scaling by pointing clients at replicas. π
π Hybrid Queries π
Valkey-Search does hybrid queries: it combines vector similarity search with filtering on indexed fields, like Numeric and Tag indexes. Mix and match, bestie.
π Tag index π
Tags are text fields that get interpreted as a list of tags separated by a separator character. Generally, tags are small sets of values with a finite set of possibilities β color, book genre, city name, author, that kind of thing.
- Only indexed fields can be used as a tag filter.
- TAG fields are tokenized by a separator character, which is a comma
,by default but configurable during index creation. - Only prefix and exact pre filters can be performed on a tag field. Suffix and infix queries are not supported.
- By default, tags are case insensitive. For example,
BlueandBLUEboth get indexed asblueand will yield the same result in a hybrid query. - Empty strings are neither indexed or queried.
- During indexing and querying, any trailing whitespace is removed.
Syntax
Here are some examples of building a filter query on a field named color.
Here { and } are part of the syntax, and | is used as an OR operator to support multiple tags. The general syntax is:
@<field_name>:{<tag>}
or
@<field_name>:{<tag1> | <tag2>}
or
@<field_name>:{<tag1> | <tag2> | ...}
For example, this query returns documents with blue OR black OR green color:
@color:{blue | black | green}
As another example, this query returns documents containing hello world or hello universe:
@color:{hello world | hello universe}
π Numeric Index π
Numeric indexes let you filter queries so they only return values that sit between a given start and end value.
- Both inclusive and exclusive queries are supported.
- For open ended queries,
+infand-infcan be used to express start and end ranges.
As an example, this query returns books published between 2021 and 2024 (both inclusive). The equivalent mathematical expression is 2021 <= year <= 2024.
"@year:[2021 2024]"
While this query returns books published between 2021 (exclusive) and 2024 (inclusive). The equivalent mathematical expression is 2021 < year <= 2024:
"@year:[(2021 2024]"
This query returns books published before 2024 (inclusive). The equivalent mathematical expression is year <= 2024:
@year:[(-inf 2024]
And this query returns books published after 2015 (exclusive). The equivalent mathematical expression is year >= 2015:
@year:[2015 +inf]
π₯ Query planner π₯
A query that uses a filter expression to filter results is called a hybrid query. Any combination of tag and numeric indexes can form a hybrid query.
- Pre-filtering: Pre-filtering relies on secondary indexes (e.g. tag, numeric) to first find the matches to the filter expression, regardless of vector similarity. Once the filtered results are calculated, a brute-force search is performed to sort by vector similarity.
- Inline-filtering: Inline-filtering performs the vector search algorithm (e.g. HNSW), ignoring found vectors which don't match the filter.
Pre-filtering is faster when the filtered search space is much smaller than the original search space. When the filtered search space is large, inline-filtering becomes faster. The query planner for Valkey-Search automatically chooses between the two strategies based on the provided filter. It's an icon, it just knows. π
π«Ά Monitoring π«Ά
To check the server's overall search metrics, you can use the INFO SEARCH or INFO MODULES commands.
The following metrics are added to the INFO command's output:
search_used_memory_human: A human-friendly readable version of thesearch_used_memory_bytesmetricsearch_used_memory_bytes: The total bytes of memory that all indexes occupysearch_number_of_indexes: Index schema total countsearch_number_of_attributes: Total count of attributes for all indexessearch_total_indexed_documents: Total count of all keys for all indexessearch_background_indexing_status(String) The status of the indexing process.NO_ACTIVITYindicates idle indexingsearch_failure_requests_count: A count of all failed requests, including syntax errorssearch_successful_requests_count: A count of all successful requestssearch_hnsw_create_exceptions_count: Count of HNSW creation unexpected errorssearch_hnsw_search_exceptions_count: Count of HNSW search unexpected errorssearch_hnsw_remove_exceptions_count: Count of HNSW removal unexpected errorssearch_hnsw_add_exceptions_count: Count of HNSW addition unexpected errorssearch_hnsw_modify_exceptions_count: Count of HNSW modification unexpected errorssearch_modify_subscription_skipped_count: Count of skipped subscription modificationssearch_remove_subscription_successful_count: Count of successful subscription removalssearch_remove_subscription_skipped_count: Count of skipped subscription removalssearch_remove_subscription_failure_count: Count of failed subscription removalssearch_add_subscription_successful_count: Count of successfully added subscriptionssearch_add_subscription_failure_count: Count of failures of adding subscriptionssearch_add_subscription_skipped_count: Count of skipped subscription adding processessearch_modify_subscription_failure_count: Count of failed subscription modificationssearch_modify_subscription_successful_count: Count of successful subscription modifications
π CONFIGURATION π
Static configuration
The following list of configurations can be passed to the loadmodule command:
--reader-threads: (Optional) Controls the amount of threads executing queries. (Default: number of physical CPU cores on the host machine)--writer-threads: (Optional) Controls the amount of threads processing index mutations. (Default: number of physical CPU cores on the host machine)--use-coordinator: (Optional) Cluster mode enabler. Default:false.--hnsw-block-size: (Optional) Specifies the allocation block size used by the HNSW graph for storing new vectors. Larger block sizes may improve performance by enhancing CPU cache efficiency, but come at the cost of increased memory usage due to pre-allocation for potential future growth. (Default:10K)--log-levelControls the log verbosity level. Possible values are:debug,verbose,noticeandwarning. (Default: Valkey's log level)
Runtime configuration
The following list of configurations can be modified at runtime using the CONFIG SET command:
search.hnsw-block-size::Specifies the allocation block size used by the HNSW graph for storing new vectors. Larger block sizes may improve performance by enhancing CPU cache efficiency, but come at the cost of increased memory usage due to pre-allocation for potential future growth. (Default:10K)
okay that's the whole page bestie, you ate that π this is Valkey-Search 9.0.0, dated 2025-10-21, and that's a wrap β go index something iconic π¦β¨π
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms