For AI agents: this page is also available as Markdown at /docs/ingesting-documents.md. Every docs page is: add .md to its URL. llms.txt lists them all.

Ingesting documents

Documents go into a collection as JSON posted to /v1/collections/{c}/documents. The collection must already exist (see Collections). The Ingest tab of a collection in the console and the MCP index_documents tool do the same thing, and Elasticsearch, OpenSearch and Solr clients can keep their own write APIs (see Other ways in).

Document shape

A document is a JSON object with fields defined by its schema. Give every document an id so you can replace or delete it later.

{
  "id": "b1",
  "title": "The Way of Kings",
  "genre": "fantasy",
  "year": 2010,
  "tags": ["epic", "fantasy"],
  "location": [-74.006, 40.7128],
  "embedding": [0.12, -0.08, 0.31]
}

Not supported: automatic embedding on ingest. Compute embeddings in your pipeline and send them in the document.

Send documents

POST /v1/collections/{c}/documents takes a JSON array, an object with a docs array, or NDJSON with one document per line.

curl -X POST "https://api.warpsearch.io/v1/collections/books/documents?commit=true" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {"id": "b1", "title": "Dune", "genre": "scifi", "year": 1965},
    {"id": "b2", "title": "Dune Messiah", "genre": "scifi", "year": 1969}
  ]'

The _bulk API (the same at /compat/opensearch). refresh=true plays the part of commit=true:

curl -X POST "https://api.warpsearch.io/compat/es/books/_bulk?refresh=true" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/x-ndjson" \
  --data-binary @- <<'DOCS'
{"index": {"_id": "b1"}}
{"title": "Dune", "genre": "scifi", "year": 1965}
{"index": {"_id": "b2"}}
{"title": "Dune Messiah", "genre": "scifi", "year": 1969}
DOCS
curl -X POST "https://api.warpsearch.io/compat/solr/books/update?commit=true" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {"id": "b1", "title": "Dune", "genre": "scifi", "year": 1965},
    {"id": "b2", "title": "Dune Messiah", "genre": "scifi", "year": 1969}
  ]'

The options, responses and errors below are those of the WarpSearch endpoint; the compatible APIs answer in their own formats.

Options can also go inside an object body:

{"docs": [{"id": "b1", "title": "Dune"}], "commit": true, "all_or_none": false}

To send an existing NDJSON file, let curl pass the bytes through unchanged:

curl -X POST "https://api.warpsearch.io/v1/collections/books/documents" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/x-ndjson" \
  --data-binary @books.ndjson
Option Meaning
commit=true Wait for the local commit that makes documents searchable. See Writes, visibility and durability.
durability=true or durability=strong Wait for local commit, or for commit plus object-store persistence on managed collections. Also accepted in a write envelope.
all_or_none=true Apply the whole request or nothing: one bad document rolls back the rest. The request must fit in a single backend update, so keep these batches small.

The response reports the outcome:

{"status": "ok", "indexed": 2, "failed": 0, "took_ms": 14}

status is ok (everything written), partial (some failed) or error (nothing written).

Replace a document

Posting a document with an existing id replaces the whole document, so fields you leave out are removed. The same call creates and replaces.

Partial updates

Use PATCH /v1/collections/{c}/documents/{id} with operations such as:

{"set": {"genre": "classic"}, "upsert": false, "durability": "strong"}

Operations include set, remove, increment, decrement, add, add_unique and remove_value. upsert defaults to true; set it to false when a missing id should fail. For several documents, use POST /v1/collections/{c}/documents/_patch with a docs array, each entry carrying its id and operations. Elasticsearch _update and bulk update accept doc, doc_as_upsert and upsert.

Patches apply to the latest committed document and require retrievable fields. Partitioned collections do not support patches. Concurrent updates to the same id can overwrite each other; serialize those updates in your application. There is no compare-and-set guarantee. After an ambiguous failure, read the document before repeating an increment or append.

Delete by query is not supported. Delete by id instead.

Get a document

curl https://api.warpsearch.io/v1/collections/books/documents/b1 \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"
curl https://api.warpsearch.io/compat/es/books/_doc/b1 \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"
curl "https://api.warpsearch.io/compat/solr/books/get?id=b1" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"

This returns {"id": ..., "fields": {...}}. A document is readable once committed, not in real time, and it needs only the viewer role.

Delete documents

# One document
curl -X DELETE "https://api.warpsearch.io/v1/collections/books/documents/b1?commit=true" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"

# Many, by id
curl -X POST https://api.warpsearch.io/v1/collections/books/documents/_delete \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ids": ["b1", "b2"], "commit": true}'
curl -X DELETE "https://api.warpsearch.io/compat/es/books/_doc/b1?refresh=true" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"

_bulk takes delete actions for many ids.

curl -X POST "https://api.warpsearch.io/compat/solr/books/update?commit=true" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"delete": ["b1", "b2"]}'

Deleting an id that does not exist succeeds. Deleting needs the writer role.

Partial failures

A write can succeed for most documents and fail for a few and still return a normal HTTP response, so always read the body. It lists each failure with its position and id:

{
  "status": "partial",
  "indexed": 1,
  "failed": 1,
  "errors": [
    {"index": 1, "id": "b2", "code": "unknown_field", "message": "Field not found: nosuffix"}
  ],
  "took_ms": 9
}

A failed document leaves any older version with the same id untouched. Fix the documents named in errors and send just those again.

Values are checked against the field's type. A value that cannot be converted fails its document with invalid_value and a message naming the field; the other documents are indexed. Numeric strings such as "12" are accepted for numeric fields, and "abc" in an int field is rejected:

{"index": 1, "id": "b2", "code": "invalid_value", "message": "field 'year': cannot parse 'abc' as an integer"}

See Checks at ingest.

Large requests are split into several backend updates. If one fails after the first has been applied, the response is 207 and lists every remaining document as failed, with a warning that they were not written (and not committed, if you asked for a commit). Retry exactly those documents. Because writes replace by id, retrying is safe.

Other failures are not per document and are explained in Limits and errors:

Status Code Meaning
400 invalid_request Malformed body, or no documents.
403 forbidden Your key has the viewer role, and writing needs writer.
404 not_found The collection does not exist, or your key has no role on it.
413 request_too_large Over your plan's documents or bytes per request. Send smaller batches.
429 rate_limited, resource_exhausted Slow down and retry after Retry-After.
503 warming_up The collection is loading from idle. Retry after Retry-After.

Batching and throughput

Other ways in

Client How it writes
Elasticsearch and OpenSearch _bulk or the single-document _doc APIs at /compat/es or /compat/opensearch. Unknown indices are created on the fly when your key is allowed to create collections. update actions merge doc fields; scripts and conditional updates are refused. See Elasticsearch and OpenSearch.
Solr /compat/solr/{collection}/update accepts JSON documents and add, delete by id and commit commands. Delete by query and atomic updates are not supported. See Solr.
turbopuffer The turbopuffer SDKs write with upsert_rows or upsert_columns at /compat/turbopuffer, where a namespace is a collection. See turbopuffer compatibility.
AI agents The MCP index_documents and delete_documents tools take the same shapes, with commit: true for immediate searchability. See Guide for AI agents.

Checklist

  1. Create the collection and its schema first.
  2. Use stable ids so loads can be repeated.
  3. Send batches, read every response body, retry only the failed documents.
  4. Commit on the last batch, then confirm with a count:
curl -X POST https://api.warpsearch.io/v1/count/books \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language": "lucene", "query": "*:*"}'

View this page as Markdown

Cookie settings

Optional tracking stays off until you choose it. Your choice applies to this browser for 180 days. Read the details.

Essential storage keeps you signed in, protects forms, and remembers this choice. It is always available.