From af3911087b8526c9cd5b89fe6739b34d394ee113 Mon Sep 17 00:00:00 2001 From: DavIvek Date: Wed, 29 Apr 2026 15:30:58 +0200 Subject: [PATCH 1/2] Document parameterized WITH CONFIG for vector indexes memgraph#3959 lets the WITH CONFIG map accept query parameters: either the whole map ($config) or individual values ({"dimension": $dim, ...}). Add a short subsection covering both forms. --- pages/querying/vector-search.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pages/querying/vector-search.mdx b/pages/querying/vector-search.mdx index e7ce04be7..2934240c5 100644 --- a/pages/querying/vector-search.mdx +++ b/pages/querying/vector-search.mdx @@ -105,6 +105,26 @@ CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG vector_index_config.con The function is evaluated at index-creation time. Both the node and edge index variants support this syntax. +### Using parameters for configuration + +The `WITH CONFIG` map accepts query parameters, both for the whole map and for individual values. This lets a client supply the configuration at query time without rebuilding the Cypher string. + +Pass the entire config as a parameter: + +```cypher +CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG $config; +``` + +with `$config` bound by the client to a map such as `{dimension: 128, capacity: 1000, metric: "cos"}`. + +Or parameterize individual values: + +```cypher +CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG {"dimension": $dim, "capacity": $cap}; +``` + +Both forms work for `CREATE VECTOR INDEX` and `CREATE VECTOR EDGE INDEX`. + ## Run vector search To run vector search, call the `vector_search` query module: use `vector_search.search()` for a vector index on nodes and `vector_search.search_edges()` for a vector index on edges. From 83b113fe1e1889097ab490511529ff5c59f0791e Mon Sep 17 00:00:00 2001 From: DavIvek Date: Wed, 29 Apr 2026 15:35:26 +0200 Subject: [PATCH 2/2] change ordering --- pages/querying/vector-search.mdx | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/pages/querying/vector-search.mdx b/pages/querying/vector-search.mdx index 2934240c5..876c06b86 100644 --- a/pages/querying/vector-search.mdx +++ b/pages/querying/vector-search.mdx @@ -73,6 +73,27 @@ The following options apply to both single-store vector indexes (nodes) and vect If resizing fails due to memory limitations, an exception will be thrown. Default value is `2`. - `scalar_kind: string (default=f32)` ➡ The [scalar kind](#scalar-kind) used to store each vector component. Smaller types reduce memory usage but may decrease precision. + +### Using parameters for configuration + +The `WITH CONFIG` map accepts query parameters, both for the whole map and for individual values. This lets a client supply the configuration at query time without rebuilding the Cypher string. + +Pass the entire config as a parameter: + +```cypher +CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG $config; +``` + +with `$config` bound by the client to a map such as `{dimension: 128, capacity: 1000, metric: "cos"}`. + +Or parameterize individual values: + +```cypher +CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG {"dimension": $dim, "capacity": $cap}; +``` + +Both forms work for `CREATE VECTOR INDEX` and `CREATE VECTOR EDGE INDEX`. + ### Using a function for configuration Instead of a static map literal, you can pass a **query module function** that returns the configuration map. This lets you centralize index configurations and reuse them across queries. @@ -105,26 +126,6 @@ CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG vector_index_config.con The function is evaluated at index-creation time. Both the node and edge index variants support this syntax. -### Using parameters for configuration - -The `WITH CONFIG` map accepts query parameters, both for the whole map and for individual values. This lets a client supply the configuration at query time without rebuilding the Cypher string. - -Pass the entire config as a parameter: - -```cypher -CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG $config; -``` - -with `$config` bound by the client to a map such as `{dimension: 128, capacity: 1000, metric: "cos"}`. - -Or parameterize individual values: - -```cypher -CREATE VECTOR INDEX idx ON :Label(embedding) WITH CONFIG {"dimension": $dim, "capacity": $cap}; -``` - -Both forms work for `CREATE VECTOR INDEX` and `CREATE VECTOR EDGE INDEX`. - ## Run vector search To run vector search, call the `vector_search` query module: use `vector_search.search()` for a vector index on nodes and `vector_search.search_edges()` for a vector index on edges.