surrealdb-vector
Vector search with SurrealDB using HNSW indexes, KNN queries, and similarity scoring. Use when creating vector indexes, querying vectors with KNN distance operators, building semantic search or RAG pipelines, tuning HNSW parameters (EFC, M, M0, distance function, type), or implementing recommendatio
By surrealdb · 376 installs
npx skills add surrealdb/agent-skills --skill surrealdb-vector
Source repository · Upstream listing
SurrealDB Vector Search
HNSW Index
Create a basic HNSW index:
With specific distance function and type:
Available types: F64 , F32 , I64 , I32 , I16 .
Full Table Example
HNSW Parameters
Parameter Description
DIMENSION Vector dimensionality (must match your embeddings)
DIST Distance function: COSINE , EUCLIDEAN , etc.
TYPE Numeric type: F64 , F32 , I64 , I32 , I16
EFC Construction search effort (higher = better index)
M Max connections per node
M0 Max connections at layer 0
Querying Vectors
The < K, EF operator performs KNN search. K is the number of results,
EF is the search effort (higher = more accurate, slower).
Recommended effort values:
40 — default, good accuracy
17 — fast but may miss some results
Basic KNN Query
vector::distance::knn() uses the distance function defined by the index.
Scored Results with Threshold