surrealdb-vector
/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 recommendation systems with SurrealDB. Triggers: HNSW, vector, embedding, KNN, cosine, euclidean, semantic search, RAG, vector::distance.
- Author
- surrealdb ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 29.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 29.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
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 recommendation systems with SurrealDB. Triggers: HNSW, vector, embedding, KNN, cosine, euclidean, semantic search, RAG, vector::distance.
Original author description
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 recommendation systems with SurrealDB. Triggers: HNSW, vector, embedding, KNN, cosine, euclidean, semantic search, RAG, vector::distance.
How it works
- HNSW Index
- Querying Vectors
SKILL.md preview
---
name: surrealdb-vector
description: "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 recommendation systems with SurrealDB. Triggers: HNSW, vector, embedding, KNN, cosine, euclidean, semantic search, RAG, vector::distance."
metadata:
author: surrealdb
version: "0.1.0"
---
# SurrealDB Vector Search
## HNSW Index
Create a basic HNSW index:
```surql
DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4;
```
With specific distance function and type:
```surql
DEFINE INDEX hnsw_idx ON pts FIELDS point HNSW DIMENSION 4 DIST EUCLIDEAN TYPE F64;
```
Available types: `F64`, `F32`, `I64`, `I32`, `I16`.
### Full Table Example
```surql
DEFINE TABLE OVERWRITE document SCHEMALESS;
DEFINE FIELD OVERWRITE embedding ON document TYPE array<float>;
DEFINE INDEX OVERWRITE hnsw_idx_document ON document
FIELDS embedding
HNSW DIMENSION 384
DIST COSINE
TYPE F32
EFC 150 M 12 M0 24;
```
### 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
```surql
SELECT
*,
vector::distance::knn() AS dist
FROM document
WHERE embedding <|10, 40|> $vector;
```
`vector::distance::knn()` uses the distance function defined by the index.
### Scored Results with Threshold
```surql
SELECT *, score
FROM (
SELECT *, (1 - vector::distance::knn()) AS score
FROM document
WHERE embedding <|20, 40|> $vector
)
WHERE score >= $threshold
ORDER BY score DESC;
```
Versions
The database has no other skills named surrealdb-vector.
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version c68164624dcd (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 100neo4j-vector-index-skill
Create and manage Neo4j vector indexes, run vector similarity search (ANN/kNN), store embeddings on nodes or relationships, use SEARCH clause (Neo4j 2026.01+, preferred) or db.index.vector.queryNodes() procedure (deprecated 2026.04, still works on 2025.x), configure HNSW and… - 100elasticsearch-vectors
Elasticsearch 8.15+ vector search. dense_vector with HNSW, kNN search, hybrid BM25 + kNN with RRF, reranker integration, ELSER learned-sparse, sparse_vector, int8 scalar quantization, and index performance tuning. USE WHEN: user mentions "elasticsearch vector", "dense_vector",… - 100redis-search
Redis Search guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, JSON path), DIALECT 2 query syntax, FT.SEARCH / FT.AGGREGATE / FT.HYBRID command selection, vector similarity with HNSW or FLAT, hybrid retrieval combining… - 100scylladb-vector-search
Guides users through implementing and optimizing ScyllaDB Vector Search for semantic similarity, RAG, and similar use cases. Use this skill when users need to store and query embeddings, build vector indexes (HNSW), run approximate nearest neighbour (ANN) queries, apply… - 90vector-index-tuning
Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure. - 100vector-index-tuning
Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.