Updating a document
Use the PUT method on the base URL of the Sitecore Search Ingestion API to replace all attribute values in an index document.
When an administrator recrawls a pull source, either manually or through scheduled crawls, Search updates all index documents with the latest data from your original content. This action overwrites any updates you made through the Ingestion API if they aren't also applied to the original content. To prevent this, we recommend that you always update the original content with changes made through the Ingestion API. This synchronization ensures that your modifications are maintained in future crawls.
To use the Ingestion API to update a document, make a PUT call to the Partial Update Document endpoint.
For the data model of this method and a description of objects and keys, see the Ingestion API reference. You can view your base URL in the Developer Resources section of Search.
The PUT (update) and PATCH (partially update) methods differ. Use PUT (update) when you want Sitecore Search to replace all fields with the values you pass and delete fields you do not pass. Use PATCH when you want Search to replace the fields you pass and leave other fields as-is.
For example, an index document exists with the title, description, and image_URL fields. If you pass a PUT call with only the title and description fields, Search assumes that you want to do two things - update the title and description fields and delete the image_URL field. If you pass a PATCH call with only the title and description fields, Search updates these fields and does not modify any other field.
For example, you want to update the title and add a new attribute, image_url, to an existing index document in one locale. To do this, make a PUT call to https://<base-url>/domains/<domainID>/sources/<sourceID>/entities/<entity>/documents/<documentID>?locale=<locale>
Here's a sample PUT cURL call:
If your request is successful, you get a 200 response with this body:
In the response, enqueued means that Search has added this document to its indexing queue. After indexing has completed, you can see the updated index document in the Content Collection section of Search.