batchDeleteDocument method
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 Amazon Web Services CloudWatch. Any error messages
related to the processing of the batch are sent to your Amazon Web
Services 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.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter documentIdList :
One or more identifiers for documents to delete from the index.
Parameter indexId :
The identifier of the index that contains the documents to delete.
Implementation
Future<BatchDeleteDocumentResponse> batchDeleteDocument({
required List<String> documentIdList,
required String indexId,
DataSourceSyncJobMetricTarget? dataSourceSyncJobMetricTarget,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSKendraFrontendService.BatchDeleteDocument'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DocumentIdList': documentIdList,
'IndexId': indexId,
if (dataSourceSyncJobMetricTarget != null)
'DataSourceSyncJobMetricTarget': dataSourceSyncJobMetricTarget,
},
);
return BatchDeleteDocumentResponse.fromJson(jsonResponse.body);
}