-
Notifications
You must be signed in to change notification settings - Fork 0
Document Operations
Nikita Ganzikov edited this page Jan 6, 2026
·
2 revisions
Manage documents within your indexes.
Add one or more documents to an index.
Endpoint: POST /indexes/:id/documents
Query Parameters:
-
format(optional) - Input format:jsoneachrow(default),msgpack. See Formats for details.
Request Body:
Documents in the specified format. Default is JSON Lines format (one JSON object per line):
{"id": "1", "title": "First Document", "content": "Hello World"}
{"id": "2", "title": "Second Document", "content": "Foo Bar"}
{"title": "Third Document", "content": "Auto-generated ID"}
Example:
curl -X POST "http://localhost:3000/indexes/products/documents?format=jsoneachrow" \
-H "Content-Type: application/json" \
-d '{"id": "1", "name": "Widget", "price": 19.99}
{"id": "2", "name": "Gadget", "price": 29.99}'Response: 201 Created
{
"indexed": 2
}Notes:
- If a document has an ID that matches the
primaryKey, it will be used - If no ID is provided, a UUID v7 will be generated automatically
- If a document with the same ID exists, it will be updated
Update specific fields of a document.
Endpoint: PATCH /indexes/:id/documents/:documentid
Request Body:
{
"field1": "new value",
"field2": "another value"
}Example:
curl -X PATCH "http://localhost:3000/indexes/products/documents/1" \
-H "Content-Type: application/json" \
-d '{"price": 24.99, "inStock": true}'Response: 200 OK
{
"id": "1",
"name": "Widget",
"price": 24.99,
"inStock": true
}Delete a document by its ID.
Endpoint: DELETE /indexes/:id/documents/:documentid
Example:
curl -X DELETE "http://localhost:3000/indexes/products/documents/1"Response: 204 No Content
Delete documents by IDs or filter query.
Endpoint: DELETE /indexes/:id/documents
Query Parameters:
-
ids[](optional) - Array of document IDs to delete -
filter(optional) - Query string to filter documents
Example - Delete by IDs:
curl -X DELETE "http://localhost:3000/indexes/products/documents?ids[]=1&ids[]=2&ids[]=3"Example - Delete by Filter:
curl -X DELETE "http://localhost:3000/indexes/products/documents?filter=category:electronics"Response: 204 No Content
Notes:
- You must provide either
ids[]orfilterparameter - Using both parameters together will return an error
- The filter uses Bleve query syntax (see Query Syntax)