Skip to main content

Index configuration

These keyword arguments to client.create_index() configure the index. There is no index_config argument and no IndexIVFFlat / IndexIVFPQ / IndexIVFSQ types.

Key management

Pass exactly one of the two to create_index(); passing both returns ValidationError.

Vector item

The dict shape upsert() accepts:

Query result

query() returns a flat list for one query vector, and a list of lists for a batch:
Vector queries return distance (lower is closer). Hybrid queries (text=) return score instead (higher is more relevant).

MetadataResult

The item type query_metadata() returns, importable as cyborgdb.MetadataResult:

Field selection

include picks the fields returned besides id: get() defaults to ["vector", "contents", "metadata"]; query() defaults to [], which returns only id.

Metadata filtering

filters on query(), query_binary(), and query_metadata() uses MongoDB-style operators. Nested fields use dot-paths such as "loc.city".

Operators

$gt, $gte, $lt, and $lte require a number; any other value returns ValidationError. $not can’t be nested inside a field ({"price": {"$not": ...}} returns ValidationError); wrap the whole condition instead. $regex and $contains resolve from the index only on fields created with pattern: True: query() falls back to a slower post-filter otherwise, and query_metadata() rejects the filter.

Examples

Dates

CyborgDB has no date type. Store dates in metadata as integer milliseconds since the Unix epoch (UTC), so range operators work on them:
Values come back as integers. Convert one back to a datetime with:
A date stored as a string, such as "2026-01-15", only works with equality filters. Range operators need a number, so {"$gte": "2026-01-01"} returns ValidationError.

Distance metrics