Partially updating a document

Use the PATCH method on the base URL of the Ingestion API to update one or more attribute values in an index document.

Important

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 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 partially update a document, make a PATCH 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.

Note

For example, you want to update the image_url attribute for index documents in two locales.

Here is a sample PATCH cURL call:

RequestResponse
curl --location 'https://<base-url>/domains/<domainID>/sources/<sourceID>/entities/<entity>/documents/<documentID>?locale=<locale1>&locale=<locale2>' \
--header 'Content-Type: application/json' \
--header 'Authorization: <api-key>' \
--data '{
    "document": {
        "id": "test_id_123",
        "fields": {
        "image_url": "www.newimageURL.com"
        }
    }
}' \
-X PATCH

If your request is successful, you get a 200 response with this body:

RequestResponse
{
    "enqueued": true
}

In the response, enqueued means that Search has added this document to its indexing queue. After a few minutes, you'll see the updated index document in the Content Collection section of Search.

Do you have some feedback for us?

If you have suggestions for improving this article,