Encrypted Index
Query Vectors
POST
Query Vectors
Retrieve the nearest neighbors for a given query vector. Passing
Any valid credential is accepted — the root key or a per-user
Supported operators:
With Filters:
Semantic Search:
Hybrid Query (BM25 + Vector):
Three-Way Query (Vector + BM25 + Metadata):
Batch Query:
High Recall Query:
text alongside query_vectors turns this into a hybrid query that fuses BM25 full-text ranking with the vector ranking (see Full-Text and Hybrid Search). Adding filters on top composes with either form — including a three-way query (vector + BM25 + metadata); see Combining search legs.
Authentication
Required - API key viaX-API-Key header:
cdbk_ token. When RBAC is not enabled (CYBORGDB_SERVICE_ROOT_KEY unset), no header is required.
Request Body
Single Query Request
Batch Query Request
Semantic Search Request (with embedding model)
Hybrid queries accept fewer filters than pure vector queries. Filtering on a
full_text or filterable: false field, or using $regex/$contains on a non-pattern field, works in a pure query but is rejected with 400 when text is set. To keep such a filter, run the query without text.Response
Single Query Response
Whenquery_vectors is a 1D array or query_contents is used:
Batch Query Response
Whenquery_vectors is a 2D array (array of arrays):
The response format automatically matches the request format:
- Single query → flat array of results
- Batch query → nested array with results for each query
Hybrid Query Response
Whentext is set alongside query_vectors, each result carries a score (fused BM25 + vector relevance, higher = more relevant) instead of distance — a text-only match has no vector distance to report:
Metadata Filtering
Use MongoDB-style query operators:$eq, $ne, $in, $nin, $exists, $gt, $gte, $lt, $lte, $regex, $contains, combined with $and, $or, $nor, $not
Filtering works on any metadata field; the index’s metadata_schema only decides how a filter is resolved — fields marked filterable (the default) are answered from the inverted index, and $regex / $contains are answered from the regex dictionary on pattern fields. Anything else falls back to a post-filter over the decrypted metadata, which is correct but slower. Dates have no native type: store and filter them as epoch milliseconds.
Combining Search Legs
Vector similarity, BM25 full-text, and metadata filtering are independent legs that compose in one request:
On a three-way query the filter is resolved once, before retrieval, and the surviving IDs constrain both the vector and BM25 legs — so both rankings are computed over the same filtered candidate set, then fused by RRF. A filter that matches nothing short-circuits to an empty result without running either leg.
alpha still applies: 0 reduces the query to BM25 + metadata, 1 to vector + metadata, and either exact endpoint skips the dead leg’s retrieval entirely.
Any query with
text set accepts only filters the metadata index can resolve exactly (see the Note above) — this includes the three-way form.Exceptions
400 Bad Request
400 Bad Request
Invalid values (e.g. vector dimension mismatch with the index), or a hybrid-parameter violation — a filter disallowed on a hybrid (
text) query (see the Note above), text on an index with no full_text field, a text_fields entry that is not a full_text field, a text knob (text_fields / text_field_weights / require_all_terms) without text, alpha outside [0, 1], rrf_k <= 0, or window_mult < 1404 Not Found
404 Not Found
Index not found
422 Unprocessable Entity
422 Unprocessable Entity
Request body failed validation (missing/mistyped fields)
500 Internal Server Error
500 Internal Server Error
Internal server error
Example Usage
Basic Query:If
embedding_model is configured for the index, you can use either query_vectors for direct vector search or query_contents for text-based semantic search.