Collections
Schemas, field types, and flags — and the endpoints that manage them.
A collection is created with a name and a list of field definitions. The schema is fixed at creation time; there is currently no endpoint to modify a collection's fields after it's created.
{
"name": "products",
"fields": [
{ "name": "title", "type": "text" },
{ "name": "brand", "type": "keyword", "facet": true },
{ "name": "price", "type": "int", "filter": true, "sort": true }
],
"default_sorting_field": "price"
}Field types
| Type | Description |
|---|---|
text | Tokenized, full-text searchable |
keyword | Exact-value string, not tokenized — good for filter/facet |
int | Whole number |
float | Floating-point number |
bool | true / false |
date | Date/time value |
There is no array/multi-value type name — a field's cardinality is inferred from the values you index into it.
Field flags
Every flag defaults to false except index and optional, which default
to true.
| Flag | Default | Effect |
|---|---|---|
facet | false | Field can be passed to the facet search parameter |
filter | false | Field can be used in a filter expression |
sort | false | Field can be used in the sort parameter |
index | true | Field is indexed for full-text search |
optional | true | Documents may omit this field |
boost | — | Optional per-field relevance multiplier (float) |
A field must be declared with filter: true, facet: true, or sort: true
to be usable that way — using an undeclared field in a filter, sort, or facet
parameter returns a 400 invalid_query error.
Typo tolerance and default sort
typo_tolerance and default_sorting_field are set per collection at
creation time:
typo_tolerance— see Typo Tolerance for the full config shape.default_sorting_field— used to break ties, or as the sort order when a search doesn't specifysortexplicitly.
Managing collections
| Method | Endpoint | Description |
|---|---|---|
POST | /collections | Create a collection |
GET | /collections | List all collections |
GET | /collections/{name} | Get one collection's schema and stats |
DELETE | /collections/{name} | Delete a collection and its data |
GET/POST responses include num_documents and num_segments alongside
the schema. Full parameter and response details: API Reference → Collections.