Documents
Indexing, fetching, and deleting individual documents.
Documents are plain, flat JSON objects — there's no envelope or wrapper
around them. id is implicit: every document has one, but it's never
declared as a schema field, and field names starting with _ are reserved.
Indexing
POST /collections/{name}/documents accepts either a single document object
or a JSON array of documents, indexed as one batch:
curl -X POST localhost:8108/collections/products/documents \
-H 'Content-Type: application/json' \
-d '[
{"id": "1", "title": "Wireless Mouse", "brand": "Logitech", "price": 2999},
{"id": "2", "title": "Mechanical Keyboard", "brand": "Razer", "price": 8999}
]'Each document in a batch is indexed independently — one invalid document doesn't fail the rest of the batch. The response reports per-document outcomes:
{
"num_indexed": 2,
"num_failed": 0,
"results": [
{ "success": true, "id": "1", "error": null, "code": null },
{ "success": true, "id": "2", "error": null, "code": null }
]
}Indexing the same id again replaces the existing document.
Fetching and deleting
| Method | Endpoint | Description |
|---|---|---|
GET | /collections/{name}/documents/{id} | Fetch a single document |
DELETE | /collections/{name}/documents/{id} | Delete a single document |
Deletes take effect immediately for subsequent searches, though the underlying segment data is only physically reclaimed on the next merge — see Persistence.
Full request/response shapes: API Reference → Documents.