Adds one or more documents to an Amazon Q Business index.
You use this API to:
-
ingest your structured and unstructured documents and documents stored in an Amazon S3 bucket into an Amazon Q Business index.
-
add custom attributes to documents in an Amazon Q Business index.
-
attach an access control list to the documents added to an Amazon Q Business index.
You can see the progress of the deletion, and any error messages related to the process, by using CloudWatch.
Parameters:
-
application_id
(ApplicationId)
–
The identifier of the Amazon Q Business application.
-
index_id
(IndexId)
–
The identifier of the Amazon Q Business index to add the documents to.
-
documents
(Documents)
–
One or more documents to add to the index.
Ensure that the name of your document doesn't contain any confidential information. Amazon Q Business returns document names in chat responses and citations when relevant.
-
role_arn
(Optional[RoleArn], default:
None
)
–
The Amazon Resource Name (ARN) of an IAM role with permission to access your S3 bucket.
-
data_source_sync_id
(Optional[ExecutionId], default:
None
)
–
The identifier of the data source sync during which the documents were added.
Raises:
-
AccessDeniedException
–
You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.
-
ConflictException
–
You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again.
-
InternalServerException
–
An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help.
-
ResourceNotFoundException
–
The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.
-
ServiceQuotaExceededException
–
You have exceeded the set limits for your Amazon Q Business service.
-
ThrottlingException
–
The request was denied due to throttling. Reduce the number of requests and try again.
-
ValidationException
–
The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_qbusiness/_services/async_q_business.py
| async def batch_put_document(
self,
application_id: "capo_qbusiness.types.application_id.ApplicationId",
index_id: "capo_qbusiness.types.index_id.IndexId",
documents: "capo_qbusiness.types.documents.Documents",
*,
config_overrides: Optional[AsyncQBusinessClientConfig] = None,
role_arn: Optional["capo_qbusiness.types.role_arn.RoleArn"] = None,
data_source_sync_id: Optional[
"capo_qbusiness.types.execution_id.ExecutionId"
] = None,
) -> "capo_qbusiness.types.batch_put_document_response.BatchPutDocumentResponse":
"""<p>Adds one or more documents to an Amazon Q Business index.</p> <p>You use this API to:</p> <ul> <li> <p>ingest your structured and unstructured documents and documents stored in an Amazon S3 bucket into an Amazon Q Business index.</p> </li> <li> <p>add custom attributes to documents in an Amazon Q Business index.</p> </li> <li> <p>attach an access control list to the documents added to an Amazon Q Business index.</p> </li> </ul> <p>You can see the progress of the deletion, and any error messages related to the process, by using CloudWatch.</p>
Args:
application_id: <p>The identifier of the Amazon Q Business application.</p>
index_id: <p>The identifier of the Amazon Q Business index to add the documents to. </p>
documents: <p>One or more documents to add to the index.</p> <important> <p>Ensure that the name of your document doesn't contain any confidential information. Amazon Q Business returns document names in chat responses and citations when relevant.</p> </important>
role_arn: <p>The Amazon Resource Name (ARN) of an IAM role with permission to access your S3 bucket.</p>
data_source_sync_id: <p>The identifier of the data source sync during which the documents were added.</p>
Raises:
capo_qbusiness.errors.access_denied_exception.AccessDeniedException: <p> You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.</p>
capo_qbusiness.errors.conflict_exception.ConflictException: <p>You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again.</p>
capo_qbusiness.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
capo_qbusiness.errors.resource_not_found_exception.ResourceNotFoundException: <p>The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.</p>
capo_qbusiness.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded the set limits for your Amazon Q Business service. </p>
capo_qbusiness.errors.throttling_exception.ThrottlingException: <p>The request was denied due to throttling. Reduce the number of requests and try again.</p>
capo_qbusiness.errors.validation_exception.ValidationException: <p>The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.</p>
capo_qbusiness.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_qbusiness.types.batch_put_document_request.BatchPutDocumentRequest]",
) -> AsyncOperationResponse[
"capo_qbusiness.types.batch_put_document_response.BatchPutDocumentResponse"
]:
import capo_qbusiness._operations.expert_q.batch_put_document
(
output,
http_response,
) = await capo_qbusiness._operations.expert_q.batch_put_document.async_batch_put_document(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("BatchPutDocument")
)
input_: capo_qbusiness.types.batch_put_document_request.BatchPutDocumentRequest = {
"application_id": application_id,
"index_id": index_id,
"documents": documents,
}
if role_arn is not None:
input_["role_arn"] = role_arn
if data_source_sync_id is not None:
input_["data_source_sync_id"] = data_source_sync_id
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|