Add or replace documents

POST /indexes/{indexUid}/documents

Add a list of documents or replace them if they already exist.

If you send an already existing document (same id) the whole existing document will be overwritten by the new document. Fields previously in the document not present in the new document are removed.

For a partial update of the document see Add or update documents route.


If the provided index does not exist, it will be created.


Use the reserved _geo object to add geo coordinates to a document. _geo is an object made of lat and lng field.

Use the reserved _vectors arrays of floats to add embeddings to a document. _vectors is an array of floats or multiple arrays of floats in an outer array.

Headers

  • Content-Type string Required

    The content-type associated with the format to be indexed

    Values are application/json, text/csv, or application/x-ndjson.

Path parameters

  • indexUid string Required

    Index Unique Identifier

Query parameters

  • The primary key of the documents. primaryKey is optional. If you want to set the primary key of your index through this route, it only has to be done the first time you add documents to the index. After which it will be ignored if given.

  • Customize the csv delimiter when importing CSV documents. By default its a comma ","

    Default value is ,.

application/json

Body Required

array array

Responses

  • 202 application/json

    Accepted

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
  • 413 application/json

    Payload Too Large

    Hide response attributes Show response attributes object
POST /indexes/{indexUid}/documents
curl \
 -X POST https://example.meilisearch.com:7700/indexes/movies/documents \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json"
Request example
# Headers
Content-Type: application/json

# Payload
[]
Response examples (202)
{
  "taskUid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "documentAdditionOrUpdate",
  "enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (401)
{
  "message": "The Authorization header is missing. It must use the bearer authorization method.",
  "code": "missing_authorization_header",
  "type": "auth",
  "link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}
Response examples (413)
{
  "message": "The provided payload reached the size limit. The maximum accepted payload size is 20.00 MiB.",
  "code": "payload_too_large",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#payload_too_large"
}