PUT /v2/indices/{index public key}/documents:batch
Update a batch of documents or create new documents with predefined ids.
Payload
The request body should be a JSON object, listing the documents inside a “documents” array.
{
"documents": [
{
"url": "https://www.example.com/product1.html",
"id": "8700a03070a37982924597d6baa87be7",
"thumbnail_external_src": "https://www.example.com/thumbnail-image.jpg",
"custom_fields": {
"title": "Example product",
"description": "Description for example product",
"price_cents": 599,
"average_customer_rating": 4.5
}
},
{
"url": "https://www.example.com/product2.html",
"id": "d3b07384d113edec49eaa6238ad5ff00",
"thumbnail_external_src": "https://www.example.com/another-thumbnail-image.jpg",
"custom_fields": {
"title": "Example product",
"description": "Description for example product",
"price_cents": 349,
"average_customer_rating": 4.2
}
}
]
}
Field | Description | Type | Notes |
---|---|---|---|
documents | A list that includes the documents added for updating | An array of document objects | |
url | Document's URL | string | |
id | Document's id | string | URL encoded as md5 hash. |
thumbnail_external_src | Thumbnails's URL | string | A URL of an image used as a thumbnail for the document by default |
Standard field | Any of the standard fields described here except the URL. | Dependent on the field. | Each field should be a separate key-value pair. |
custom_fields | Top level | A map of custom fields key value pairs | Supported data-types: text, integer and double. |
The maximum size of the request body is limited to a total of 1M bytes.
Each document in the array must contain either a URL or an id field. If id is not present, the md5 checksum of the URL field will be used. If a document exists with a given id, it will be fully replaced by the given document.