BatchDeleteDocument - Amazon Kendra API Reference


Removes one or more documents from an index. The documents must have been added with the BatchPutDocument API.

The documents are deleted asynchronously. You can see the progress of the deletion by using AWS CloudWatch. Any error messages related to the processing of the batch are sent to your AWS CloudWatch log. You can also use the BatchGetDocumentStatus API to monitor the progress of deleting your documents.

Deleting documents from an index using BatchDeleteDocument could take up to an hour or more, depending on the number of documents you want to delete.

Request Syntax

{ "DataSourceSyncJobMetricTarget": { "DataSourceId": "string", "DataSourceSyncJobId": "string" }, "DocumentIdList": [ "string" ], "IndexId": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


Maps a particular data source sync job to a particular data source.

Type: DataSourceSyncJobMetricTarget object

Required: No


One or more identifiers for documents to delete from the index.

Type: Array of strings

Array Members: Minimum number of 1 item. Maximum number of 10 items.

Length Constraints: Minimum length of 1. Maximum length of 2048.

Required: Yes


The identifier of the index that contains the documents to delete.

Type: String

Length Constraints: Fixed length of 36.

Pattern: [a-zA-Z0-9][a-zA-Z0-9-]*

Required: Yes

Response Syntax

{ "FailedDocuments": [ { "ErrorCode": "string", "ErrorMessage": "string", "Id": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


A list of documents that could not be removed from the index. Each entry contains an error message that indicates why the document couldn't be removed from the index.

Type: Array of BatchDeleteDocumentResponseFailedDocument objects


For information about the errors that are common to all actions, see Common Errors.


You don't have sufficient access to perform this action. Please ensure you have the required permission policies and user accounts and try again.

HTTP Status Code: 400


A conflict occurred with the request. Please fix any inconsistences with your resources and try again.

HTTP Status Code: 400


An issue occurred with the internal server used for your Amazon Kendra service. Please wait a few minutes and try again, or contact Support for help.

HTTP Status Code: 500


The resource you want to use doesn’t exist. Please check you have provided the correct resource and try again.

HTTP Status Code: 400


The request was denied due to request throttling. Please reduce the number of requests and try again.

HTTP Status Code: 400


The input fails to satisfy the constraints set by the Amazon Kendra service. Please provide the correct input and try again.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: