SynapCores

AI-Native Database Vector Database - User Documentation

By , Founder & CTO, SynapCores · Published · Updated

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

  1. Overview
  2. Getting Started
  3. Embedding Generation
  4. Distance Metrics
  5. Indexing Strategies
  6. CRUD Operations
  7. SQL Integration
  8. REST API
  9. Best Practices
  10. 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

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

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.

Characteristics:

  • Graph-based approximate nearest neighbor search
  • Serves top-k queries: ORDER BY the similarity function that matches the index metric, then LIMIT k
  • Tunable recall: higher m, ef_construction and ef_search values find more of the true nearest neighbors; lower m and ef_construction values 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"}
    }]
  }'

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

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

SQL Integration

Vector Data Type

Create tables with native vector columns. VECTOR(n) holds vectors of n dimensions: the products table in Getting Started uses VECTOR(384), the size of the built-in model. For vectors from your own model, declare their size:

-- 768-dimensional image embeddings from your own model
CREATE TABLE image_embeddings (
    id TEXT PRIMARY KEY,
    image_url TEXT,
    embedding VECTOR(768)
);

Write a vector as a string literal such as '[0.12, -0.03, 0.27, ...]', with one number per dimension, or write $1 in the SQL and pass the vector as a string, such as "[0.12, -0.03, 0.27, ...]", in the parameters array of POST /v1/query/execute.

AI Functions

EMBED() - Generate Embeddings

-- The built-in model (MiniLM, 384 dimensions)
SELECT EMBED('wireless headphones');

-- Use in INSERT
INSERT INTO products (id, name, category, price, in_stock, embedding)
VALUES (
    'prod_20004',
    'Over-Ear Studio Headphones',
    'electronics', 149.00, true,
    EMBED('Over-Ear Studio Headphones Closed-back monitor sound')
);

Vector Similarity Functions

In WHERE, write the similarity expression itself; ORDER BY and HAVING can use its alias.

COSINE_SIMILARITY():

SELECT
    id,
    name,
    COSINE_SIMILARITY(embedding, EMBED('wireless bluetooth headphones')) as similarity_score
FROM products
WHERE COSINE_SIMILARITY(embedding, EMBED('wireless bluetooth headphones')) > 0.7
ORDER BY similarity_score DESC
LIMIT 10;

EUCLIDEAN_DISTANCE():

-- Images most similar to img_001 (lower distance is closer)
SELECT
    id,
    EUCLIDEAN_DISTANCE(embedding, (SELECT embedding FROM image_embeddings WHERE id = 'img_001')) as distance
FROM image_embeddings
ORDER BY distance ASC
LIMIT 5;

INNER_PRODUCT():

SELECT
    user_id,
    item_id,
    INNER_PRODUCT(user_embedding, item_embedding) as relevance_score
FROM recommendations
WHERE INNER_PRODUCT(user_embedding, item_embedding) > 0.5
ORDER BY relevance_score DESC;

Advanced SQL Patterns

Semantic Search with Joins

-- Find customers who purchased similar products
SELECT
    c.customer_id,
    c.customer_name,
    p.name AS product_name,
    o.order_date,
    COSINE_SIMILARITY(p.embedding, EMBED('premium headphones')) as relevance
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
JOIN order_items oi ON o.order_id = oi.order_id
JOIN products p ON oi.product_id = p.id
WHERE
    o.order_date > CURRENT_DATE - INTERVAL '90 days'
    AND COSINE_SIMILARITY(p.embedding, EMBED('premium headphones')) > 0.5
ORDER BY relevance DESC, o.order_date DESC
LIMIT 50;

Aggregations with Vectors

-- Average similarity by category
SELECT
    category,
    COUNT(*) as product_count,
    AVG(COSINE_SIMILARITY(embedding, EMBED('headphones'))) as avg_relevance
FROM products
GROUP BY category
HAVING avg_relevance > 0.3
ORDER BY avg_relevance DESC;

Subqueries with Vectors

-- Find products similar to top sellers
WITH top_products AS (
    SELECT p.id, p.embedding
    FROM products p
    JOIN order_items oi ON p.id = oi.product_id
    GROUP BY p.id, p.embedding
    ORDER BY SUM(oi.quantity) DESC
    LIMIT 10
)
SELECT DISTINCT
    p.id,
    p.name,
    MAX(COSINE_SIMILARITY(p.embedding, tp.embedding)) as max_similarity
FROM products p
CROSS JOIN top_products tp
LEFT JOIN top_products seller ON seller.id = p.id   -- keep products that are not top sellers
WHERE seller.id IS NULL
GROUP BY p.id, p.name
HAVING MAX(COSINE_SIMILARITY(p.embedding, tp.embedding)) > 0.7
ORDER BY max_similarity DESC
LIMIT 20;

REST API

Base URL

http://localhost:8080/v1

Authentication

Send a Bearer token with every vector, embedding and SQL request: a login token from POST /v1/auth/login or an API key (see Getting Started, step 2):

Authorization: Bearer <your_api_token>

Endpoints

Method Endpoint Purpose
GET /vectors/collections List all collections
POST /vectors/collections Create collection
GET /vectors/collections/:name Get collection info
DELETE /vectors/collections/:name Delete collection
POST /vectors/collections/:name/vectors Insert or replace vectors
GET /vectors/collections/:name/vectors/:id Get vector by ID
DELETE /vectors/collections/:name/vectors/:id Delete vector
POST /vectors/collections/:name/search Search vectors
POST /vectors/collections/:name/search/batch Batch search
POST /ai/embeddings Embed text (the EMBED() model)
POST /ai/embeddings/batch Embed several texts
POST /query/execute Run SQL

A batch search sends one query per entry in queries and returns one list of matches per query:

curl -X POST http://localhost:8080/v1/vectors/collections/products/search/batch \
  -H "Authorization: Bearer $SYNAPCORES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries": [{"vector": [0.1, ...], "k": 5}, {"vector": [0.2, ...], "k": 5}]}'
# -> {"data": {"results": [[...matches for query 1...], [...matches for query 2...]]}, ...}

Complete Workflow Example

# 1. Create collection
curl -X POST http://localhost:8080/v1/vectors/collections \
  -H "Authorization: Bearer $SYNAPCORES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "documents",
    "dimensions": 384,
    "distance_metric": "cosine",
    "index_type": "hnsw"
  }'

# 2. Embed the document text (data.embeddings holds 384 numbers)
curl -X POST http://localhost:8080/v1/ai/embeddings \
  -H "Authorization: Bearer $SYNAPCORES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "Getting Started: install SynapCores and run your first query"}'

# 3. Insert documents, with the embedding from step 2 as values
curl -X POST http://localhost:8080/v1/vectors/collections/documents/vectors \
  -H "Authorization: Bearer $SYNAPCORES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "vectors": [{
      "id": "doc_001",
      "values": [0.0143, -0.1226, ...],
      "metadata": {"title": "Getting Started", "type": "guide"}
    }]
  }'

# 4. 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": "how to get started"}'

# 5. Search documents with the query embedding from step 4 as the vector
curl -X POST http://localhost:8080/v1/vectors/collections/documents/search \
  -H "Authorization: Bearer $SYNAPCORES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "vector": [0.0393, -0.0616, ...],
    "k": 10,
    "include_metadata": true
  }'

Best Practices

1. Choosing Embedding Dimensions

Dimensions Model Use Case Trade-off
384 MiniLM, built in (EMBED() and POST /v1/ai/embeddings) General-purpose, cost-effective Best balance
768 or 1024 Your own model (vectors computed in your application) Domain-specific text, image embeddings 2x or 2.7x storage cost
1536 or 3072 Your own model (vectors computed in your application) Domain-specific text, image embeddings 4x or 8x storage cost

Recommendation: Start with 384 dimensions (MiniLM) for most use cases. For vectors from your own model, compute them in your application and store them in a VECTOR(n) column of that size, or in a collection created with that many dimensions.

2. Batch Operations

Always use batch operations for:

  • Bulk data imports
  • Periodic reindexing
  • Data migrations

How to Batch:

  • SQL: one multi-row INSERT ... VALUES or INSERT ... SELECT statement embeds and writes many rows, and one UPDATE ... SET embedding = EMBED(...) re-embeds a whole table
  • REST: send many vectors in one vectors array, embed many texts with POST /v1/ai/embeddings/batch, and run several searches with POST /v1/vectors/collections/:name/search/batch
  • Fewer requests mean less API call overhead

Batch Size: Keep each REST insert body within 130,816 bytes of JSON with the default configuration (15 to 25 vectors of 384 dimensions, depending on how many digits each number carries). A larger body returns HTTP 413 vector_request_too_large, which names the byte limit.

3. Query Optimization

Shape Vector Queries for the Index: write similarity searches as top-k queries that ORDER BY the function matching the index metric and LIMIT k, and check the plan with EXPLAIN. An unfiltered top-k query reads the HNSW index. WHERE conditions are applied in the scan, through a B-tree index when the filtered column has one, and the matching rows are ranked exactly.

-- Top-k search: the plan shows HNSW IndexScan on idx_products_embedding
EXPLAIN SELECT id, name, COSINE_SIMILARITY(embedding, EMBED('headphones')) AS similarity
FROM products
ORDER BY similarity DESC
LIMIT 10;

-- Filtered top-k search: index the filter column; the plan shows IndexScan on idx_products_category
CREATE INDEX idx_products_category ON products (category);

EXPLAIN SELECT id, name, price, COSINE_SIMILARITY(embedding, EMBED('headphones')) AS similarity
FROM products
WHERE category = 'electronics' AND price < 200
ORDER BY similarity DESC
LIMIT 10;

Cache Frequent Queries:

  • Cache popular search embeddings in your application
  • Reuse embeddings for identical queries
  • Reduces embedding generation overhead

4. Error Handling

Implement Retry Logic:

import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

session = requests.Session()
retry = Retry(
    total=3,
    backoff_factor=0.3,
    status_forcelist=[429, 502, 503, 504],
    allowed_methods=None  # also retry POST: searches and inserts are POST requests
)
adapter = HTTPAdapter(max_retries=retry)
session.mount('http://', adapter)
session.mount('https://', adapter)

Give vectors explicit IDs: a retried insert then replaces the same vector instead of adding a copy.

Size Concurrency to Your Instance:

  • The engine runs up to max_concurrent_queries SQL statements at once (32 in the shipped configuration) and queues further requests (a queue_capacity of 128 with that setting); GET /v1/query/admission reports capacity, active, queued and queue_capacity
  • Keep your client's concurrency within that capacity, and queue requests in your application during traffic peaks
  • Retry HTTP 503 responses with exponential backoff

5. Monitoring and Observability

Track Key Metrics in Your Application:

  • Query latency (p50, p95, p99)
  • Search accuracy/relevance
  • Embedding generation time
  • API error rates
  • Query admission: active and queued from GET /v1/query/admission

Log Important Events:

  • Failed embedding generations
  • Slow queries (over your application's latency target), with their EXPLAIN ANALYZE time
  • Retried requests (HTTP 503) and split batches (HTTP 413)

Common Use Cases

-- Create product table with embeddings (the Getting Started schema)
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS idx_products_embedding ON products (embedding) USING HNSW WITH (metric = 'cosine');

-- Index products
INSERT INTO products (id, name, category, price, in_stock, embedding)
SELECT
    product_id,
    name,
    category,
    price,
    in_stock,
    EMBED(name || ' ' || description)
FROM product_catalog;

-- Search by semantic meaning
SELECT
    id,
    name,
    price,
    COSINE_SIMILARITY(embedding, EMBED('wireless headphones')) as relevance
FROM products
WHERE COSINE_SIMILARITY(embedding, EMBED('wireless headphones')) > 0.5
ORDER BY relevance DESC
LIMIT 20;

Use Case 2: Content Recommendations

-- Find similar articles based on user reading history:
-- score each unread article by its average similarity to the articles the user read
WITH read_articles AS (
    SELECT a.embedding
    FROM user_reading_history urh
    JOIN articles a ON urh.article_id = a.article_id
    WHERE urh.user_id = 'user_42'
)
SELECT
    a.article_id,
    a.title,
    AVG(COSINE_SIMILARITY(a.embedding, r.embedding)) as relevance
FROM articles a
CROSS JOIN read_articles r
WHERE a.article_id NOT IN (
    SELECT article_id FROM user_reading_history WHERE user_id = 'user_42'
)
GROUP BY a.article_id, a.title
HAVING AVG(COSINE_SIMILARITY(a.embedding, r.embedding)) > 0.3
ORDER BY relevance DESC
LIMIT 10;

Use Case 3: Duplicate Detection

-- Find near-duplicate documents
SELECT
    d1.document_id as doc1_id,
    d2.document_id as doc2_id,
    COSINE_SIMILARITY(d1.embedding, d2.embedding) as similarity
FROM documents d1
JOIN documents d2 ON d1.document_id < d2.document_id
WHERE COSINE_SIMILARITY(d1.embedding, d2.embedding) > 0.95
ORDER BY similarity DESC;

Use Case 4: Customer Support Routing

-- Find similar resolved tickets
SELECT
    t.ticket_id,
    t.subject,
    t.resolution,
    COSINE_SIMILARITY(t.embedding, EMBED('My headphones do not connect to my laptop over Bluetooth')) as similarity
FROM support_tickets t
WHERE
    t.status = 'resolved'
    AND COSINE_SIMILARITY(t.embedding, EMBED('My headphones do not connect to my laptop over Bluetooth')) > 0.8
ORDER BY similarity DESC
LIMIT 5;

Troubleshooting

Slow Query Performance

Symptoms: Vector queries take longer than expected

Solutions:

  1. Verify the HNSW index is being used: EXPLAIN on a top-k query shows HNSW IndexScan with the index name
  2. Write the search as a top-k query: ORDER BY the similarity function that matches the index metric, and LIMIT it to the number of results you need
  3. Index the columns you filter on, so a filtered search reads the matching rows through a B-tree IndexScan
  4. Measure with EXPLAIN ANALYZE, which reports the query's actual time and rows

High API Error Rates

Symptoms: Frequent 4xx or 5xx responses

Solutions:

  1. Read the response body: it names the cause, such as dimension_mismatch, Write permission required or vector_request_too_large. A request body that leaves out a required field or gives one the wrong type returns HTTP 422 naming the field (HTTP 400 invalid_query_request on POST /v1/query/execute), and JSON that doesn't parse returns HTTP 400. Spell optional fields such as threshold, filter and include_metadata exactly as on this page.
  2. Send Authorization: Bearer <token> with every vector, embedding and SQL request; log in again when a login token expires (after 24 hours by default), or use an API key
  3. Retry HTTP 503 with exponential backoff, and split vector inserts that return HTTP 413 into smaller batches
  4. Check GET /health and the engine log (docker logs synapcores, or sudo journalctl -u synapcores on a native Linux install): each failed SQL query appears as a WARN Query failed line with the error text, and each vector or embedding request that returns HTTP 500 as an ERROR line with the cause
  5. Cache frequently used embeddings

Unexpected Search Results

Symptoms: Irrelevant results in semantic search

Solutions:

  1. Tighten the threshold: raise a SQL COSINE_SIMILARITY cutoff (try 0.8 instead of 0.7), lower the REST threshold, which is a distance in a cosine or euclidean collection (try 0.2 instead of 0.3), or raise it in a dotproduct collection
  2. Verify input text is being embedded correctly
  3. Embed queries with the same model as the stored vectors, so the query vector has the collection's dimensions (GET /v1/vectors/collections/:name shows them)
  4. Review metadata filters for correctness

Embedding Generation Failures

Symptoms: EMBED() function errors or timeouts, or long documents that match poorly

Solutions:

  1. Split long documents into chunks of a few hundred words and store one row per chunk. EMBED() reads the first 512 tokens of its input (about 400 English words) and logs longer input as embedding input truncated to the encoder budget
  2. Read the error message in the response body and the matching WARN or ERROR line in the engine log (docker logs synapcores, or sudo journalctl -u synapcores on a native Linux install)
  3. Check that GET /health returns "status": "ok", then retry with exponential backoff

Client Libraries

Python

import requests

class SynapCoresClient:
    def __init__(self, api_token):
        self.base_url = "http://localhost:8080/v1"
        self.headers = {
            "Authorization": f"Bearer {api_token}",
            "Content-Type": "application/json"
        }

    def embed(self, text):
        response = requests.post(
            f"{self.base_url}/ai/embeddings",
            headers=self.headers,
            json={"text": text}
        )
        response.raise_for_status()
        return response.json()["data"]["embeddings"]

    def search(self, collection, query_text, k=10, threshold=0.5):
        # threshold is a cosine distance: lower is closer
        response = requests.post(
            f"{self.base_url}/vectors/collections/{collection}/search",
            headers=self.headers,
            json={
                "vector": self.embed(query_text),
                "k": k,
                "threshold": threshold,
                "include_metadata": True
            }
        )
        response.raise_for_status()
        return response.json()["data"]

# Usage
client = SynapCoresClient("aidb_...")
results = client.search("products", "wireless headphones", k=10)

JavaScript/TypeScript

class SynapCoresClient {
    constructor(apiToken) {
        this.baseUrl = 'http://localhost:8080/v1';
        this.headers = {
            'Authorization': `Bearer ${apiToken}`,
            'Content-Type': 'application/json'
        };
    }

    async embed(text) {
        const response = await fetch(`${this.baseUrl}/ai/embeddings`, {
            method: 'POST',
            headers: this.headers,
            body: JSON.stringify({ text })
        });
        if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
        return (await response.json()).data.embeddings;
    }

    async search(collection, queryText, k = 10, threshold = 0.5) {
        // threshold is a cosine distance: lower is closer
        const response = await fetch(
            `${this.baseUrl}/vectors/collections/${collection}/search`,
            {
                method: 'POST',
                headers: this.headers,
                body: JSON.stringify({
                    vector: await this.embed(queryText),
                    k,
                    threshold,
                    include_metadata: true
                })
            }
        );
        if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
        return (await response.json()).data;
    }
}

// Usage
const client = new SynapCoresClient('aidb_...');
const results = await client.search('products', 'wireless headphones', 10);

Performance Expectations

Latency and Throughput

Query latency and throughput depend on your hardware, data size, vector dimensions, index settings and configuration, so measure them on your own instance: EXPLAIN ANALYZE runs a query and reports its actual time and rows, and GET /v1/query/admission shows how many SQL statements are running and queued.


Support and Resources

Documentation

Community

Support

Tutorials

  • Getting Started: Build your first semantic search step by step — see the recipe library
  • Production Deployment: Self-hosted with docker run or Docker Compose (see the Docker guide), or fully managed cloud for Enterprise
  • Advanced Patterns: Hybrid search, RAG, and multi-modal applications

Pricing

Community Edition — free, self-hosted, unlimited use. One docker run and you're running; no signup, no usage-based billing, no credit card.

Enterprise — managed cloud deployment or self-hosted with support SLAs, priced per seat. Talk to us for details.


Conclusion

SynapCores provides a production-ready, self-hosted vector database with:

✅ Semantic Search - Find similar content by meaning, not keywords ✅ SQL Integration - Combine vector and relational queries ✅ Easy to Use - Simple API and SQL functions ✅ Fast Search - HNSW top-k similarity search inside SQL ✅ Self-Hosted or Managed - one container you run (or a native install), or a managed cloud deployment for Enterprise — your data never has to leave your infrastructure

Start building AI-powered applications today — download Community Edition


Document Version: SynapCores 2.5.1-ce Last Updated: November 23rd, 2026 For Technical Support: support@synapcores.com


Copyright © 2025–2026 SynapCores. All rights reserved.