Skip to content

Add or Update Document

Overview

This endpoint allows you to add or update a document in an index. The primary key defined on the index determines if the operation is an add or an update.

Endpoint

POST https://api.lixiasearch.com/v1/indexes/{indexId}/documents

Request Body

{
    "fields": [
        {
            "name": "string",
            "value": any
        },
        ...
    ]
}
  • fields: An array of key-value pairs. Each field defined in the index must be provided.
    • name: The name of the field.
    • value: The value of the field.

Example

curl https://api.lixiasearch.com/v1/indexes/<INDEX_ID>/documents \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --data '{
        "fields": [
            {"name": "body", "value": "Sample body content"},
            {"name": "id", "value": 4},
            {"name": "title", "value": "Sample Title"},
        ]
    }'

Ensure you replace <ACCESS_TOKEN> with your actual access token and <INDEX_ID> with the appropriate index id.

Response Body

(empty body)

{}