Skip to main content
POST
Query by Metadata
Find items by metadata alone — no query vector. With no text, the filter is resolved entirely against the encrypted metadata index and the matching items are returned unscored. With text, a BM25 full-text search runs over the index’s full_text fields and the top matches are returned ranked by score; a filter given alongside restricts which items are scored. Works on untrained indexes. To add a vector leg on top of either form, use /v1/vectors/query — see Combining search legs.

Authentication

Required - API key via X-API-Key header:
Any valid credential is accepted — the root key or a per-user cdbk_ token. When RBAC is not enabled (CYBORGDB_SERVICE_ROOT_KEY unset), no header is required.

Request Body

Filter constraints

Unlike /v1/vectors/query, which falls back to a post-filter over the decrypted metadata when a filter cannot be answered from the index, /v1/vectors/query_metadata has no fallback stage — every filter leaf must be resolvable from the encrypted metadata index. That makes the index’s metadata_schema enforcement instead of a performance hint:
  • $regex / $contains require the field to have been declared pattern: true at index create time.
  • A field declared filterable: false cannot be filtered on here at all.
  • $type is not supported on this endpoint.
Any of these come back as 400 with the reason; use /v1/vectors/query with a vector for filters that need the post-filter path. Nested dot-paths (loc.city) are supported. Supported operators: $and, $or, $nor, $not, $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $exists, $regex (pattern fields only), $contains (pattern fields only).

Response

Filter-only query — each result row is {"id"} (there is nothing to score):
Text query — each result row is {"id", "score"} in descending BM25 score order:

Exceptions

Filter references a field the metadata index cannot resolve — a $regex/$contains on a non-pattern field, a filterable: false field, or an unsupported operator. Also raised for text-parameter violations: 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, or order_by combined with text
Authentication failed (invalid API key) or wrong index_key on SDK-supplied indexes — see error model
Index not found
Invalid request parameters
Internal server error

Example Usage

Filter only (all matches, unordered):
Combined operators with a result cap:
Sorted descending by a metadata field (top_k applies after the sort):
Full-text search (index must have at least one full_text field; results ranked by BM25 score):
Regex match (field must have been created with pattern: true):