PUT /v2/indices/{index public key}/documents/{document id}
Update existing document, or create a new document with predefined URL or ID.
{ "custom_fields": { "title": "Example product", "description": "Description for example product", "price_cents": 599, "average_customer_rating": 4.5 } }
Field | Description | Type | Notes |
---|---|---|---|
custom_fields | Top level | A map of custom fields key value pairs | Supported data-types: text, integer, and double. |
PUT /v2/indices/{index public key}/documents/
Omit the document id in the URL of the request if you include either a document id or a “url” field in the document content.
{ "url": "https://www.example.com/", "id": "8700a03070a37982924597d6baa87be7", "custom_fields": { "title": "Example product", "description": "Description for example product", "price_cents": 599, "average_customer_rating": 4.5 } }
Field | Description | Type | Notes |
---|---|---|---|
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. | Depends 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. |
If the URL does not contain the document id, the id of the document will be resolved to either:
The supported data types for the custom fields are:
Dates should be defined as UNIX timestamps with integer values.
Please note that once you have defined a specific data type for the custom field, the data type cannot be changed.
Indexing unsupported values will fail. If you have defined an unsupported data type, create a new custom field with a different name.
{ "id": "123", "url": "https://www.example.com/page.html", "language": "en", "title": "An example article title", "main_content": "The text content of the article. The automatic highlight in search results will only be generated from the content of this field.", "custom_fields": { "image_url": "https://www.example.com/page.png", "article_categories": ["Block post", "Article"] } }
On successful queuing of the update, the endpoint returns an HTTP 202. Please note that it might take a few seconds for the changes to become available.
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.