Add or replace documents
Add a list of documents or replace them if they already exist.
If you send an already existing document (same id) the whole existing document will be overwritten by the new document. Fields previously in the document not present in the new document are removed.
If the provided index does not exist, it will be created.
Accepted content types: application/json, application/x-ndjson, text/csv.
Note: Use the reserved _geo object to add geo coordinates: {"lat": 48.8566, "lng": 2.3522}.
For a partial update see add or update documents route.
Authorizations
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
Unique identifier of the index.
Query Parameters
The primary key field for uniquely identifying each document. This parameter is optional and can only be set the first time documents are added to an index. Subsequent attempts to specify it will be ignored if the primary key has already been set.
Customize the CSV column delimiter when importing CSV documents. Must be a single ASCII
character. Only valid when the content type is text/csv; using this parameter with
application/json or application/x-ndjson will return an error. Default: ,.
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.
When set to true, only updates existing documents and skips creating
new ones. Documents that don't already exist in the index will be
ignored. This is useful for partial updates where you only want to
modify existing records without adding new ones.
Body
The body is of type any.
Response
Task successfully enqueued.
A summarized view of a task, returned when a task is enqueued
Unique sequential identifier of the task.
x >= 0Status of the task. Possible values are enqueued, processing,
succeeded, failed, and canceled.
enqueued, processing, succeeded, failed, canceled "processing"
Type of operation performed by the task.
documentAdditionOrUpdate, documentEdition, documentDeletion, settingsUpdate, indexCreation, indexDeletion, indexUpdate, indexSwap, taskCancelation, taskDeletion, dumpCreation, snapshotCreation, export, upgradeDatabase, indexCompaction, networkTopologyChange "documentAdditionOrUpdate"
Date and time when the task was enqueued.
Unique identifier of the targeted index. Null for global tasks.
Custom metadata attached to this task at creation. Use it to associate tasks with external systems or add application-specific information.