Add or update documents
Add a list of documents or update them if they already exist.
If you send an already existing document (same id) the old document will be only partially updated according to the fields of the new document. Thus, any fields not present in the new document are kept and remained unchanged.
To completely overwrite a document, see Add or replace 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
,
.
Body Required
curl \
-X PUT https://example.meilisearch.com:7700/indexes/movies/documents \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '[{"id":25684,"title":"American Ninja 5","poster":"https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg","overview":"When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.","release_date":725846400}]'
# Headers
Content-Type: application/json
# Payload
[
{
"id": 25684,
"title": "American Ninja 5",
"poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
"overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
"release_date": 725846400
}
]
{
"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"
}