SynapCores Vector Database - User Documentation
Document Date: November 23rd, 2026 Version: SynapCores 2.5.1-ce (Community Edition) Status: Production Ready
Executive Summary
SynapCores provides self-hosted vector database capabilities with advanced indexing, similarity search, and AI-powered embedding generation — one container you start with a single docker run command (or a native install), or a fully managed cloud deployment for Enterprise. This document describes how to integrate SynapCores into your applications for semantic search, recommendations, and AI-powered features.
Table of Contents
- Overview
- Getting Started
- Embedding Generation
- Distance Metrics
- Indexing Strategies
- CRUD Operations
- SQL Integration
- REST API
- Best Practices
- Common Use Cases
Overview
SynapCores combines traditional SQL database capabilities with native vector operations, enabling you to:
- Store and search high-dimensional embeddings
- Perform semantic similarity searches
- Execute hybrid queries combining relational and vector data
- Generate embeddings directly within the database
- Index up to 50 million vectors with SQL HNSW in Community Edition
Key Features
Vector Operations:
- Multiple distance metrics (Cosine, Euclidean, Dot Product, Manhattan)
- Advanced indexing with HNSW for fast approximate search
- Exact and approximate nearest neighbor search
- Batch operations: multi-row SQL inserts, multi-vector REST inserts, batch embedding and batch search
SQL Integration:
- Native vector data types
- AI functions callable in SQL queries
- Join vector and relational data in a single query
- Standard SQL syntax with vector extensions
Data Management:
- ACID transactions on row tables, with read committed, repeatable read or serializable isolation
- Automatic, durable persistence: a successful commit is already in the write-ahead log
- API keys with full or read-only access
Getting Started
1. Run SynapCores
docker run -d --name synapcores -p 8080:8080 \
-e AIDB_ACCEPT_LICENSE=1 \
-v synapcores-data:/var/lib/synapcores \
synapcores/community:latest
No signup, no account, no credit card. The engine serves its REST API and SQL endpoint on port 8080 and keeps your data in the synapcores-data volume. Get the admin password from the first-boot log:
docker logs synapcores 2>&1 | grep -A 7 FIRST-BOOT
Prefer a native install? Run curl -fsSL https://get.synapcores.com | SYNAPCORES_REF=blog-vector-database sh. Step-by-step guides: Docker and Quickstart.
2. Generate an API Token
Log in with the admin password, then create a scoped API key on your own running instance (used for REST/SDK access):
# Log in: the response carries an access_token, valid for 24 hours by default
curl -X POST http://localhost:8080/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "<admin password>"}'
# Create an API key with that token: the response shows raw_key once
curl -X POST http://localhost:8080/v1/api-keys \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{"name": "vector-app", "permission": "FullAccess", "expires_in_days": 90}'
export SYNAPCORES_TOKEN="aidb_..."
Use "permission": "ReadOnly" for a service that only searches. Send API keys and login tokens the same way, as Authorization: Bearer <token>.
3. Connect to Your Database
SQL over HTTP:
# Run SQL on your own instance
curl -X POST http://localhost:8080/v1/query/execute \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT 1 AS one"}'
REST API:
# Base URL — your own instance
http://localhost:8080/v1
Connection Methods:
- SQL endpoint (
POST /v1/query/execute): For SQL queries - REST API: For language-agnostic HTTP-based access
Prefer not to host it yourself? Enterprise includes a fully managed cloud deployment — same engine, we run it for you.
4. Create Your First Vector Space
Using SQL (a table with a VECTOR column and an HNSW index):
CREATE TABLE products (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
category TEXT,
price DECIMAL(10,2),
in_stock BOOLEAN,
metadata JSON,
embedding VECTOR(384)
);
CREATE INDEX idx_products_embedding ON products (embedding) USING HNSW WITH (metric = 'cosine');
Using REST API (a vector collection):
curl -X POST http://localhost:8080/v1/vectors/collections \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "products",
"dimensions": 384,
"distance_metric": "cosine",
"index_type": "hnsw"
}'
SQL tables and REST vector collections are separate stores: query a table with SQL, and a collection through the /v1/vectors routes.
Embedding Generation
Supported Models
SynapCores generates embeddings inside the database with a built-in model, and stores the vectors your own embedding models produce:
| Model | Dimensions | Best For | How to Use |
|---|---|---|---|
MiniLM (all-minilm:latest, built in) |
384 | General-purpose text: semantic search, recommendations, duplicate detection | EMBED() in SQL, POST /v1/ai/embeddings over REST |
| Your own embedding model | 768, 1024, 1536 or 3072, for example | Domain-specific text, image embeddings | Compute the vectors in your application, then store them in a VECTOR(n) column or in a collection with that many dimensions |
EMBED() and POST /v1/ai/embeddings use the engine's embedding model, set as embedding_model = "all-minilm:latest" under [query.ai_service] in the shipped configuration.
Usage
Generate Embeddings in SQL:
-- The built-in model (MiniLM)
SELECT EMBED('wireless headphones');
-- Number of dimensions: 384
SELECT ARRAY_LENGTH(EMBED('wireless headphones'));
During Data Insert:
INSERT INTO products (id, name, category, price, in_stock, embedding)
VALUES (
'prod_20001',
'Bluetooth Headphones',
'electronics', 89.00, true,
EMBED('Bluetooth Headphones Premium wireless audio device')
);
Batch Processing:
-- A row loaded without an embedding
INSERT INTO products (id, name, category, price, in_stock)
VALUES ('prod_20002', 'USB-C Charging Cable', 'electronics', 12.00, true);
-- Generate embeddings for existing data
UPDATE products
SET embedding = EMBED(name || ' ' || category)
WHERE embedding IS NULL;
Distance Metrics
Choosing the Right Metric
1. Cosine Similarity (Recommended for Text)
Best for: Text embeddings, semantic search, document similarity
Range: [-1, 1] where 1 = most similar
Use when: Comparing documents, products, or text-based content
SELECT COSINE_SIMILARITY(vector1, vector2) as similarity
FROM comparisons;
Example: Find similar product descriptions
2. Euclidean Distance (L2)
Best for: Spatial data, and image embeddings from your own model
Range: [0, ∞] where 0 = identical
Use when: Comparing spatial coordinates or image features
SELECT EUCLIDEAN_DISTANCE(vector1, vector2) as distance
FROM comparisons;
Example: Find similar images
3. Dot Product
Best for: Recommendation systems
Range: (-∞, ∞)
Use when: Computing relevance scores with normalized vectors. EMBED() returns normalized vectors (length 1), so for them INNER_PRODUCT gives the same value as COSINE_SIMILARITY
SELECT INNER_PRODUCT(vector1, vector2) as score
FROM comparisons;
Example: User-item recommendations
4. Manhattan Distance (L1)
Best for: Sparse high-dimensional data
Range: [0, ∞]
Use when: Working with sparse feature vectors
SELECT MANHATTAN_DISTANCE(vector1, vector2) as distance
FROM comparisons;
Indexing Strategies
Flat Index (Exact Search)
Characteristics:
- Guarantees 100% recall (exact results)
- Searches every vector (brute-force)
- Best for small datasets
When to Use:
- Small tables and collections
- When exact results are required
- Validation and benchmarking: exact results are the reference for measuring HNSW recall
-- Exact search: a VECTOR column without a vector index
CREATE TABLE small_collection (
id TEXT PRIMARY KEY,
body TEXT,
embedding VECTOR(384)
);
Over REST, create the collection with "index_type": "flat", the default.
HNSW Index (Fast Approximate Search)
Characteristics:
- Graph-based approximate nearest neighbor search
- Serves top-k queries:
ORDER BYthe similarity function that matches the index metric, thenLIMIT k - Tunable recall: higher
m,ef_constructionandef_searchvalues find more of the true nearest neighbors; lowermandef_constructionvalues build the index faster
When to Use:
- Large tables and collections
- Production applications
- Top-k similarity search
Scale: SQL HNSW in Community Edition admits up to 50 million vectors.
-- Create with HNSW index
CREATE TABLE large_collection (
id TEXT PRIMARY KEY,
body TEXT,
embedding VECTOR(384)
);
CREATE INDEX idx_large_collection_embedding ON large_collection (embedding)
USING HNSW WITH (metric = 'cosine', m = 16, ef_construction = 200, ef_search = 64);
-- Top-k query on products (Getting Started): the plan shows HNSW IndexScan on idx_products_embedding
EXPLAIN SELECT id, name, COSINE_SIMILARITY(embedding, EMBED('wireless headphones')) AS similarity
FROM products
ORDER BY similarity DESC
LIMIT 10;
Over REST, create the collection with "index_type": "hnsw".
Match the query to the index metric:
| Top-k query | HNSW metric |
|---|---|
ORDER BY COSINE_SIMILARITY(...) DESC LIMIT k |
'cosine' |
ORDER BY EUCLIDEAN_DISTANCE(...) ASC LIMIT k |
'euclidean' |
ORDER BY DOT_PRODUCT(...) DESC LIMIT k |
'dot' |
ORDER BY MANHATTAN_DISTANCE(...) ASC LIMIT k |
'manhattan' |
Set the tuning options in WITH (...) next to metric: m takes 2 to 128, ef_construction takes m to 65536, and ef_search takes 1 to 65536. Validate recall and latency on your own data, with exact search as the reference.
Index Selection Guide
| Workload | Recommended Index | Setup |
|---|---|---|
| Small table or collection, or exact results required | Flat (exact search) | SQL: a VECTOR column without a vector index; REST: "index_type": "flat" |
| Top-k similarity search over a large table or collection | HNSW | SQL: CREATE INDEX ... USING HNSW WITH (metric = '...'); REST: "index_type": "hnsw" |
| Similarity search filtered by other columns | B-tree index on the filter columns | CREATE INDEX idx_products_category ON products (category), see Query Optimization |
CRUD Operations
1. Create Vector Space
Initialize a new table or collection for vectors:
SQL:
CREATE TABLE IF NOT EXISTS products (
id TEXT PRIMARY KEY, -- Vector ID
name TEXT NOT NULL,
category TEXT,
price DECIMAL(10,2),
in_stock BOOLEAN,
metadata JSON,
embedding VECTOR(384) -- Dimensions
);
CREATE INDEX IF NOT EXISTS idx_products_embedding ON products (embedding)
USING HNSW WITH (metric = 'cosine'); -- Distance metric
REST API:
curl -X POST http://localhost:8080/v1/vectors/collections \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "products",
"dimensions": 384,
"distance_metric": "cosine",
"index_type": "hnsw"
}'
distance_metric takes cosine (the default), euclidean or dotproduct. index_type takes flat (the default, exact search) or hnsw.
Response (HTTP 201):
{
"data": {
"name": "products",
"dimensions": 384,
"vector_count": 0,
"distance_metric": "cosine",
"index_type": "hnsw"
},
"meta": {
"request_id": "ba29a1dc-1414-4e98-a641-cb249d7a2c91",
"timestamp": "2026-11-23T19:31:10.852923Z"
}
}
2. Insert Vectors
Single Insert
SQL:
INSERT INTO products (id, name, category, price, in_stock, metadata, embedding)
VALUES (
'prod_12345',
'Wireless Bluetooth Headphones',
'electronics', 129.00, true,
JSON_OBJECT('product_id', '12345', 'category', 'electronics'),
EMBED('Wireless Bluetooth Headphones')
);
Build JSON values with JSON_OBJECT(...); metadata->>'$.category' then reads a field.
REST API:
curl -X POST http://localhost:8080/v1/vectors/collections/products/vectors \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vectors": [{
"id": "prod_12345",
"values": [0.1, 0.2, 0.3, ...],
"metadata": {
"product_id": "12345",
"category": "electronics"
}
}]
}'
Response:
{
"data": {"inserted": 1, "replaced": 0, "ids": ["prod_12345"]},
"meta": {"request_id": "2f3a9377-927f-4d20-a0ae-1680673fc9e2", "timestamp": "2026-11-23T19:31:10.866422Z"}
}
values holds the embedding: the output of EMBED() in SQL, or of POST /v1/ai/embeddings over REST (see Search Vectors).
Insert with Auto-Generated ID
In a REST collection, leave out id and the engine assigns a UUID, returned in ids:
REST API:
curl -X POST http://localhost:8080/v1/vectors/collections/products/vectors \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vectors": [{
"values": [0.1, 0.2, 0.3, ...],
"metadata": {"product_id": "44444", "category": "electronics"}
}]
}'
Batch Insert (Recommended for Bulk Data)
SQL:
-- Insert many rows in one statement; EMBED() runs for each row
INSERT INTO products (id, name, category, price, in_stock, metadata, embedding)
SELECT
product_id,
name,
category,
price,
in_stock,
JSON_OBJECT('product_id', product_id, 'category', category),
EMBED(name || ' ' || description)
FROM product_catalog;
REST API:
curl -X POST http://localhost:8080/v1/vectors/collections/products/vectors \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vectors": [
{"id": "prod_67890", "values": [0.1, ...], "metadata": {"product_id": "67890", "category": "electronics"}},
{"id": "prod_11111", "values": [0.2, ...], "metadata": {"product_id": "11111", "category": "kitchen"}},
...
]
}'
Batch Size Tip: Keep each request body within 130,816 bytes of JSON (just under 128 KiB) with the default configuration. That holds about 25 vectors of 384 dimensions with short metadata as POST /v1/ai/embeddings returns them, or 15 with the longer numbers of SQL EMBED() output. A larger body returns HTTP 413 with the code vector_request_too_large and the byte limit, so send big loads in several requests.
3. Search Vectors
Semantic Search
SQL:
SELECT
id,
metadata->>'$.product_id' AS product_id,
metadata->>'$.category' AS category,
COSINE_SIMILARITY(embedding, EMBED('wireless headphones')) AS similarity
FROM products
WHERE COSINE_SIMILARITY(embedding, EMBED('wireless headphones')) > 0.7
ORDER BY similarity DESC
LIMIT 10;
REST API: search takes a query vector. Embed the query text with POST /v1/ai/embeddings (the same model as EMBED()), then send the vector:
# 1. Embed the query text
curl -X POST http://localhost:8080/v1/ai/embeddings \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{"text": "wireless headphones"}'
# -> {"data": {"embeddings": [-0.0709, 0.0420, ...], "model": "all-minilm:latest", "dimensions": 384}, ...}
# 2. Search with that vector
curl -X POST http://localhost:8080/v1/vectors/collections/products/search \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vector": [-0.0709, 0.0420, ...],
"k": 10,
"threshold": 0.5,
"include_metadata": true
}'
Response:
{
"data": [
{
"id": "prod_12345",
"score": 0.12118739,
"metadata": {
"category": "electronics",
"product_id": "12345"
}
},
{
"id": "prod_67890",
"score": 0.43694615,
"metadata": {
"product_id": "67890",
"category": "electronics"
}
}
],
"meta": {"request_id": "d1b1f839-660d-492e-bef0-243523119c82", "timestamp": "2026-11-23T19:31:10.949085Z"}
}
In a cosine collection, score is the cosine distance (1 minus the cosine similarity): lower is closer, and matches come back closest first. threshold keeps matches with a score up to its value, so "threshold": 0.3 keeps similarities of 0.7 and above. In a euclidean collection the score is the L2 distance, and threshold is a maximum distance in the same way. In a dotproduct collection a higher score is closer: matches come back highest first, and threshold keeps scores of at least its value. Add "include_metadata": true to get each match's metadata.
Hybrid Search (Vectors + Filters)
Combine semantic search with traditional SQL filters:
SELECT
p.id,
p.name,
p.price,
COSINE_SIMILARITY(p.embedding, EMBED('noise cancelling headphones')) as similarity
FROM products p
WHERE
p.category = 'electronics'
AND p.price BETWEEN 50 AND 200
AND p.in_stock = true
AND COSINE_SIMILARITY(p.embedding, EMBED('noise cancelling headphones')) > 0.7
ORDER BY similarity DESC, p.price ASC
LIMIT 20;
Search with Metadata Filters (REST API)
curl -X POST http://localhost:8080/v1/vectors/collections/products/search \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vector": [-0.0709, 0.0420, ...],
"k": 20,
"threshold": 0.5,
"include_metadata": true,
"filter": {
"category": "electronics"
}
}'
filter keeps the matches whose metadata has every listed key and value, compared as the same JSON type: send 199 to match a stored 199, and true to match a stored true. A key can also take an operator object, such as {"price": {"$lt": 200}}, with $eq, $ne, $in, $nin, $gt, $gte, $lt or $lte.
A flat collection (the default) applies the filter before the top-k cut, so a filtered search returns the k closest matching vectors. An hnsw collection, such as the products collection created above, applies it to the closest candidates its index finds: for a filter that matches only a few vectors, search a flat collection or raise k.
4. Update Vectors
SQL:
UPDATE products
SET
embedding = EMBED('Updated product description'),
metadata = JSON_OBJECT(
'product_id', '12345',
'category', 'audio',
'updated_at', CURRENT_TIMESTAMP
)
WHERE id = 'prod_12345';
REST API: insert the vector again with the same id. The engine replaces its values and its whole metadata object. In the response, inserted counts every vector written and replaced counts the ones that already existed:
curl -X POST http://localhost:8080/v1/vectors/collections/products/vectors \
-H "Authorization: Bearer $SYNAPCORES_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vectors": [{
"id": "prod_12345",
"values": [0.1, 0.2, ...],
"metadata": {
"product_id": "12345",
"category": "audio",
"updated_at": "2025-09-01T10:00:00Z"
}
}]
}'
# -> {"data": {"inserted": 1, "replaced": 1, "ids": ["prod_12345"]}, ...}
5. Get Vector by ID
SQL:
SELECT id, name, metadata, embedding
FROM products
WHERE id = 'prod_12345';
REST API:
curl -X GET http://localhost:8080/v1/vectors/collections/products/vectors/prod_12345 \
-H "Authorization: Bearer $SYNAPCORES_TOKEN"
# -> {"data": {"id": "prod_12345", "values": [...], "metadata": {...}}, ...}
6. Delete Vectors
SQL:
-- Delete by ID
DELETE FROM products
WHERE id = 'prod_12345';
-- Delete by criteria
DELETE FROM products
WHERE metadata->>'$.category' = 'discontinued';
REST API:
# Delete single vector (HTTP 204)
curl -X DELETE http://localhost:8080/v1/vectors/collections/products/vectors/prod_12345 \
-H "Authorization: Bearer $SYNAPCORES_TOKEN"
# Delete several vectors: one request per ID
for id in prod_12345 prod_67890; do
curl -X DELETE "http://localhost:8080/v1/vectors/collections/products/vectors/$id" \
-H "Authorization: Bearer $SYNAPCORES_TOKEN"
done