CyborgDB supports metadata tagging and filtering, enabling fine-grained search filters in addition to encrypted vector search. Metadata, like vectors, are end-to-end encrypted and never exposed in plaintext outside of the client.
Supported Metadata
The following metadata types are supported:
Boolean
String
List of strings
Numbers (will be stored as fp64)
Adding Items with Metadata
To add items with metadata tags, you can pass a dictionary of key-value pairs to the metadata field during upsert:
# Example datadata = [ {"id": "item_1", "vector": [0.1, 0.1, 0.1, 0.1], "metadata": {"category": "dog"}}, {"id": "item_2", "vector": [0.2, 0.2, 0.2, 0.2], "metadata": {"category": "cat"}}]# Upsert data with metadataindex.upsert(data)
// Example dataconst data = [ {id: "item_1", vector: [0.1, 0.1, 0.1, 0.1], metadata: {category: "dog"}}, {id: "item_2", vector: [0.2, 0.2, 0.2, 0.2], metadata: {category: "cat"}}];// Upsert data with metadataawait index.upsert({ items: data });
import { VectorItem } from 'cyborgdb';// Example dataconst data: VectorItem[] = [ {id: "item_1", vector: [0.1, 0.1, 0.1, 0.1], metadata: {category: "dog"}}, {id: "item_2", vector: [0.2, 0.2, 0.2, 0.2], metadata: {category: "cat"}}];// Upsert data with metadataawait index.upsert({ items: data });
By default, every metadata field is indexed using encrypted indexing, so filters on indexed fields are resolved from the index and are fast. You can opt individual fields out of indexing with metadata_schema at index creation (see Metadata schema). Filters on non-indexed fields still work, but they are evaluated after decryption and are slower, as are $regex / $contains filters on fields not indexed for pattern matching.