PUT /v2/indices/{index public key}/documents:batch
Update a batch of documents or create new documents with predefined ids.
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", "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", "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. |
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.
We’re always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.