Skip to main content
Collections organize your documents, define their schema, and enable fast vector search, filtering, keyword search, semantic search, and multi-vector search.

Create

In order to create a collection, call the create() method on the client.collections() object:
Field names starting with _ are reserved for internal use.

Schema

Opt-in schema

TopK is schemaless-by-default. Fields without types can store any value. When types are specified, data is validated during upsert.
Indexed fields require explicit types.

Field types

Nested objects are automatically treated as structs — no need to use struct() explicitly.

Required fields

Fields are optional by default. Add required() to make them mandatory—required fields must be present in every document during upsert. Documents missing a required field are rejected with a validation error.

Indexes

Only indexed fields can be searched. Non-indexed fields support exact-match filters only.

Vector Index

Used for vector search. Supports dimensions up to 2^14. Enabled by vector_index().
Similarity metrics compatibility:

Multi-Vector Index

Enables multi-vector search on matrix() fields using the maxsim metric for late-interaction scoring. Enabled by multi_vector_index(). See multi-vector search for more information.

Keyword Index

Traditional text search with BM25 relevance scoring. Fast keyword matching with no embedding overhead. Enabled by keyword_index().

Semantic Index

Convenience method for automatic embeddings. Enabled by semantic_index().
See semantic_index() for details.

NGram Index

Accelerates substring and regular expression filters such as contains and regexp_match on text fields. Enabled by ngram_index().

List

You can list all collections in a project by iterating over client.collections().list(). Collections are returned in name order:
To list only collections whose name starts with a given string, pass it as prefix:

Get

You can get a specific collection in a project by calling client.collections().get(name):
The get() function takes the name of a collection and returns a single Collection object.

Delete

Once you decide that you no longer need a collection or that you want to start over, you can delete it. Deleting a collection will remove all the documents and indexes associated with it. To delete a collection, call the client.collections().delete(name) method:
If your collection is too large it can take a moment to delete it. You can check the status of the deletion by listing the collections again.
This operation is irreversible and will permanently delete all data in the collection.
Re-creating a collection with the same name: for about 60 seconds after a delete, writes to a new collection with the same name can be lost (a count() may show the old documents, then drop to 0). To avoid this, wait 60 seconds before re-creating, use a new name such as my-collection-v2, or keep the collection and delete its documents with a filter.