Guide
A vector index ranks node or edge embeddings by distance to a query vector. Use it for
semantic search, recommendations, and retrieval over any label that stores an
embedding as a top-level numeric array property.
Every definition declares a non-zero dimension and one distance metric: cosine,
Euclidean, or Manhattan. Stored embeddings and every query vector must have exactly
the declared dimension.
For background, see What is vector search?
and vector distance metrics.
Vector search and vector index management are native-only: Cypher and SQL have no
syntax for them. The Cypher guide
lists what Cypher covers.
Create a vector index
index_not_found, as for a missing index.
Stored vectors
An indexed property acceptsf32, f64, or i64 arrays, or a generic array of
numbers, converted to f32. A record without the property is not indexed. A write fails
when the property holds:
Existing records with such values block a build instead; see
Troubleshoot index operations.
An empty query vector, or one with
NaN or infinite components, fails with
invalid_search_input as a literal and invalid_query as a parameter.
Search an index
Search the whole index when every record of the label is a valid result. This request returns the tenDoc nodes closest to the query vector:
$distance and then by ID. Use
vectorSearchEdges / vector_search_edges (VectorSearchEdges in Go) to search an
edge index. For a tenant-partitioned index, pass the tenant value as the final
argument.
$distance exists only on the hit stream: a step to another element drops it, and a
projection ends the traversal. To keep it, bind the hit and read it with
projectBindings; see
Keep search scores after traversing.
k must be at least 1: a literal 0 fails with invalid_search_result_count, and a
parameter k of 0 or less fails with invalid_query.
Distance values
$distance is lower for closer vectors under every metric:
Straight-line distance is the square root of a Euclidean
$distance; cosine similarity
is 1 - 2 × $distance.
Index structure
Vector indexes are HNSW graphs with fixed settings:m 16 (32 on the bottom layer),
ef_construction 200, and a search ef of max(k, 100). Queries cannot change them.
Results are approximate, so a whole-index search can miss a true nearest neighbor.
Each insert searches the bottom layer from the nearest nodes it finds one layer up, so
vectors where two clusters meet stay linked to both. Indexes built by earlier releases
could leave the bottom layer split between well-separated clusters, so that a small share
of rows (about 0.5% of SIFT 1M) was not found even by its own vector. Drop and create such
an index again to rebuild it with the better-connected graph.
Prefilter with a traversal
To rank only the nodes or edges a traversal reaches, such as documents a user may access, search within the traversal instead of the whole index. See Prefiltered search. Prefilter when only some records are valid answers: filtering whole-index hits afterwards can leave fewer thank. Prefiltering also
ranks a small candidate set exactly.
Combine vector and text search
HelixDB has no operator that fuses vector and BM25 rankings. Run both searches in one read batch (one snapshot) and merge the ranked lists in your application, for example with reciprocal rank fusion:$distance and $score use different scales.
Search consistency
By default, searches include committed writes that the index worker has not published into the index yet. A read request can opt intoeventual search, which bounds that
work per search. See Search consistency
for both modes, searches in write batches, and index_backpressure.
Result limits
The server caps the effective result count of a whole-index search at 800. A narrower bound from the surrounding plan can lower it. Prefiltered searches have their own limits.Operational notes
- Creation returns before the backfill necessarily finishes.
- Writes made while an index builds are queued and published after it activates; strong searches include them as soon as the index is active. Until then they count toward index backpressure.
- A new generation remains hidden until validation and activation succeed.
- Dropping an index is also a durable lifecycle operation.
How an index is built
A vector index is built one vector at a time unless in-memory builds are turned on withHELIX_VECTOR_BULK_BUILD_MEMORY_BYTES.
With them on, an index without a tenant property is built in memory when its label’s
vectors fit the memory they are given: the whole graph is linked on every core and
written once, many times faster. An index that does not fit, and every
tenant-partitioned index, is still built serially. The
operation status
of a vector build says which, in vector_build_path:
reason is bulk_builds_disabled, over_memory_budget, too_few_vectors (fewer than
4,096), tenant_partitioned, earlier_attempts_failed, bulk_attempt_failed,
too_many_rows_changed, or resumed_serial_scan.
While a build is on the in-memory path its status also carries vector_bulk_build,
with which attempt it is (bulk_attempt of bulk_attempt_limit, reported by every
server; not the operation’s own attempt, which counts retried steps) and, from the
server running it, what it is doing:
A restart during the build discards what was written and starts the next attempt, and
the counters start again from zero. Every attempt counts that a kill, a crash, a stop
or a deploy ended. After three, the build continues serially
(
earlier_attempts_failed). A build that blocks returns to the serial stage first, so
its retry starts at attempt one. An attempt that fails in a way a serial build cannot
is not tried again: what it wrote is deleted and the index is built serially at once
(bulk_attempt_failed).
Rows written while an index is built in memory are indexed after the build, like any
write, and each one that changes after the build read it is first taken out of the
in-memory graph, which costs far more than writing a row that did not change. A build
that finds more than about an eighth of its rows changed stops its in-memory attempt,
deletes what it wrote and builds the index serially at once
(too_many_rows_changed): finishing in memory would take longer.
Next steps
Project search results
Keep ranked hit metadata while a traversal continues.
Text indexes
Rank string properties with BM25 keyword search.
Troubleshoot index operations
Resolve blocked builds and lifecycle errors.
Limits
Review supported property types and search limits.