Collections organize your documents, define their schema, and enable fast vector search, filtering, keyword search, semantic search, and multi-vector search.Documentation Index
Fetch the complete documentation index at: https://docs.topk.io/llms.txt
Use this file to discover all available pages before exploring further.
Create
In order to create a collection, call thecreate() method on the client.collections() object:
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
| Type | Use case |
|---|---|
text() | Strings, descriptions, content, IDs |
bytes() | Binary data, images, files |
int() | Integers, counts, IDs |
float() | Decimal numbers, prices |
bool() | true/false values |
list(value_type) | Arrays of text, integer, or float elements |
struct(fields) | Nested objects with named fields |
f8_vector(dim) | 8-bit float embeddings |
f16_vector(dim) | 16-bit float embeddings |
f32_vector(dim) | Dense embeddings (most common) |
u8_vector(dim) | Quantized embeddings |
i8_vector(dim) | Signed quantized embeddings |
binary_vector(dim) | Binary embeddings |
f32_sparse_vector() | Sparse embeddings |
u8_sparse_vector() | Quantized sparse embeddings |
matrix(dim, value_type) | Multi-vector embeddings |
Required fields
Fields are optional by default. Addrequired() 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 byvector_index().
| Vector Type | cosine | euclidean | dot_product | hamming |
|---|---|---|---|---|
f8_vector | ✅ | ✅ | ✅ | — |
f16_vector | ✅ | ✅ | ✅ | — |
f32_vector | ✅ | ✅ | ✅ | — |
u8_vector | ✅ | ✅ | ✅ | — |
i8_vector | ✅ | ✅ | ✅ | — |
binary_vector | — | — | — | ✅ |
f32_sparse_vector | — | — | ✅ | — |
u8_sparse_vector | — | — | ✅ | — |
Multi-Vector Index
Enables multi-vector search onmatrix() 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 bykeyword_index().
Semantic Index
Convenience method for automatic embeddings. Enabled bysemantic_index().
List
You can list all collections in a project by callingclient.collections().list():
list() function returns a list of Collection objects:
Get
You can get a specific collection in a project by callingclient.collections().get(name):
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 theclient.collections().delete(name) method: