Collections
Create, list, fetch, and delete collections.
Create a collection
Requires the admin key.
POST /collectionsRequest body — a CollectionSchema:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Collection name |
fields | array of field schemas | yes | See field shape below |
typo_tolerance | object | no | See Typo Tolerance |
default_sorting_field | string | no | Field used to break ties / default sort |
Each entry in fields:
| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | Field name |
type | "text" | "keyword" | "int" | "float" | "bool" | "date" | — | Field type |
facet | bool | false | Usable in the facet search param |
filter | bool | false | Usable in a filter expression |
sort | bool | false | Usable in the sort param |
index | bool | true | Indexed for full-text search |
optional | bool | true | Documents may omit this field |
boost | float | — | Relevance multiplier for this field |
curl -X POST localhost:8108/collections \
-H 'Content-Type: application/json' \
-H 'x-tachyon-api-key: your-admin-key' \
-d '{
"name": "products",
"fields": [
{"name": "title", "type": "text"},
{"name": "description", "type": "text"},
{"name": "brand", "type": "keyword", "facet": true},
{"name": "price", "type": "int", "filter": true, "sort": true}
]
}'Response — 201 Created, a CollectionView (the schema, flattened,
plus stats):
{
"name": "products",
"fields": [ "..." ],
"typo_tolerance": { "enabled": true, "one_typo_min_len": 4, "two_typo_min_len": 8, "max_typos": 2 },
"default_sorting_field": null,
"created_at": 1750000000000,
"num_documents": 0,
"num_segments": 0
}List collections
GET /collectionsRequires the admin or search key. Returns an array of CollectionView.
Get a collection
GET /collections/{name}Returns a single CollectionView, or 404 collection_not_found.
Delete a collection
Requires the admin key.
DELETE /collections/{name}Deletes the collection and all of its documents. Not reversible.