BatchDeleteDocument - Amazon Kendra API Reference

BatchDeleteDocument

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.

DataSourceSyncJobMetricTarget

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

Type: DataSourceSyncJobMetricTarget object

Required: No

DocumentIdList

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

IndexId

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.

FailedDocuments

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

Errors

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

AccessDeniedException

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

ConflictException

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

HTTP Status Code: 400

InternalServerException

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

ResourceNotFoundException

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

HTTP Status Code: 400

ThrottlingException

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

HTTP Status Code: 400

ValidationException

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: