Add or replace 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
, orapplication/x-ndjson
.
Path parameters
-
indexUid string Required
Index Unique Identifier
Query parameters
-
primaryKey string
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.
-
csvDelimiter string
Customize the csv delimiter when importing CSV documents. By default its a comma ","
Default value is
,
.
curl \
-X POST https://example.meilisearch.com:7700/indexes/movies/documents \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json"
# Headers
Content-Type: application/json
# Payload
[]
{
"taskUid": 0,
"indexUid": "movies",
"status": "enqueued",
"type": "documentAdditionOrUpdate",
"enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
{
"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"
}
{
"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"
}