batchDeleteDocument method

Future<BatchDeleteDocumentResponse> batchDeleteDocument({
  1. required List<String> documentIdList,
  2. required String indexId,
  3. DataSourceSyncJobMetricTarget? dataSourceSyncJobMetricTarget,
})

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

The documents are deleted asynchronously. You can see the progress of the deletion by using AWS CloudWatch. Any error messages releated to the processing of the batch are sent to you CloudWatch log.

May throw ValidationException. May throw ConflictException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw AccessDeniedException. May throw InternalServerException.

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 {
  ArgumentError.checkNotNull(documentIdList, 'documentIdList');
  ArgumentError.checkNotNull(indexId, 'indexId');
  _s.validateStringLength(
    'indexId',
    indexId,
    36,
    36,
    isRequired: true,
  );
  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);
}