Skip to main content
POST
cURL

Authorizations

Authorization
string
header
required

An API key is a token that you provide when making API calls. Read more about how to secure your project.

Include the API key to the Authorization header, for instance:

If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:

Path Parameters

index_uid
string
required

Unique identifier of the index.

Query Parameters

customMetadata
string

A string that can be used to identify and filter tasks. This metadata is stored with the task and returned in task responses. Useful for tracking tasks from external systems or associating tasks with specific operations in your application.

Body

application/json

Request body for editing documents using a RHAI function

function
string
required

A RHAI function string to apply to each document. The function has access to a doc variable representing the current document. Modify doc fields to update the document. Return null or () to delete the document. To enable this feature: PATCH /experimental-features/ {"editDocumentsByFunction": true}.

filter
any

Filter expression to select which documents to edit. If omitted, all documents in the index will be processed. Attributes must be in filterableAttributes to be used.

context
any

Arbitrary data to pass into the function scope. By default the function only has access to the current document being edited via the doc variable.

Response

Task successfully enqueued.

A summarized view of a task, returned when a task is enqueued

taskUid
integer<u-int32>
required

Unique sequential identifier of the task.

Required range: x >= 0
status
enum<string>
required

Status of the task. Possible values are enqueued, processing, succeeded, failed, and canceled.

Available options:
enqueued,
processing,
succeeded,
failed,
canceled
Example:

"processing"

type
enum<string>
required

Type of operation performed by the task.

Available options:
documentAdditionOrUpdate,
documentEdition,
documentDeletion,
settingsUpdate,
indexCreation,
indexDeletion,
indexUpdate,
indexSwap,
taskCancelation,
taskDeletion,
dumpCreation,
snapshotCreation,
export,
upgradeDatabase,
indexCompaction,
networkTopologyChange
Example:

"documentAdditionOrUpdate"

enqueuedAt
string<date-time>
required

Date and time when the task was enqueued.

indexUid
string | null

Unique identifier of the targeted index. Null for global tasks.

customMetadata
string | null

Custom metadata attached to this task at creation. Use it to associate tasks with external systems or add application-specific information.