Skip to content

create_index

create_index(
    application_id: ApplicationId,
    display_name: IndexName,
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    description: Optional[Description] = None,
    type: Optional[IndexType] = None,
    tags: Optional[Tags] = None,
    capacity_configuration: Optional[IndexCapacityConfiguration] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateIndexResponse

Creates an Amazon Q Business index.

To determine if index creation has completed, check the Status field returned from a call to DescribeIndex. The Status field is set to ACTIVE when the index is ready to use.

Once the index is active, you can index your documents using the BatchPutDocument API or the CreateDataSource API.

Parameters:

  • application_id (ApplicationId) –

    The identifier of the Amazon Q Business application using the index.

  • display_name (IndexName) –

    A name for the Amazon Q Business index.

  • description (Optional[Description], default: None ) –

    A description for the Amazon Q Business index.

  • type (Optional[IndexType], default: None ) –

    The index type that's suitable for your needs. For more information on what's included in each type of index, see Amazon Q Business tiers.

  • tags (Optional[Tags], default: None ) –

    A list of key-value pairs that identify or categorize the index. You can also use tags to help control access to the index. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.

  • capacity_configuration (Optional[IndexCapacityConfiguration], default: None ) –

    The capacity units you want to provision for your index. You can add and remove capacity to fit your usage needs.

  • client_token (Optional[ClientToken], default: None ) –

    A token that you provide to identify the request to create an index. Multiple calls to the CreateIndex API with the same client token will create only one index.

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/q_business.py
def create_index(
    self,
    application_id: "capo_qbusiness.types.application_id.ApplicationId",
    display_name: "capo_qbusiness.types.index_name.IndexName",
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    description: Optional["capo_qbusiness.types.description.Description"] = None,
    type: Optional["capo_qbusiness.types.index_type.IndexType"] = None,
    tags: Optional["capo_qbusiness.types.tags.Tags"] = None,
    capacity_configuration: Optional[
        "capo_qbusiness.types.index_capacity_configuration.IndexCapacityConfiguration"
    ] = None,
    client_token: Optional["capo_qbusiness.types.client_token.ClientToken"] = None,
) -> "capo_qbusiness.types.create_index_response.CreateIndexResponse":
    """<p>Creates an Amazon Q Business index.</p> <p>To determine if index creation has completed, check the <code>Status</code> field returned from a call to <code>DescribeIndex</code>. The <code>Status</code> field is set to <code>ACTIVE</code> when the index is ready to use.</p> <p>Once the index is active, you can index your documents using the <a href="https://docs.aws.amazon.com/amazonq/latest/api-reference/API_BatchPutDocument.html"> <code>BatchPutDocument</code> </a> API or the <a href="https://docs.aws.amazon.com/amazonq/latest/api-reference/API_CreateDataSource.html"> <code>CreateDataSource</code> </a> API.</p>

    Args:
        application_id: <p>The identifier of the Amazon Q Business application using the index.</p>
        display_name: <p>A name for the Amazon Q Business index.</p>
        description: <p>A description for the Amazon Q Business index.</p>
        type: <p>The index type that's suitable for your needs. For more information on what's included in each type of index, see <a href="https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/tiers.html#index-tiers">Amazon Q Business tiers</a>.</p>
        tags: <p>A list of key-value pairs that identify or categorize the index. You can also use tags to help control access to the index. Tag keys and values can consist of Unicode letters, digits, white space, and any of the following symbols: _ . : / = + - @.</p>
        capacity_configuration: <p>The capacity units you want to provision for your index. You can add and remove capacity to fit your usage needs.</p>
        client_token: <p>A token that you provide to identify the request to create an index. Multiple calls to the <code>CreateIndex</code> API with the same client token will create only one index.</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.
    """

    def _handler(
        req: "OperationRequest[capo_qbusiness.types.create_index_request.CreateIndexRequest]",
    ) -> OperationResponse[
        "capo_qbusiness.types.create_index_response.CreateIndexResponse"
    ]:
        import capo_qbusiness._operations.expert_q.create_index

        output, http_response = (
            capo_qbusiness._operations.expert_q.create_index.create_index(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateIndex")
    )
    input_: capo_qbusiness.types.create_index_request.CreateIndexRequest = {
        "application_id": application_id,
        "display_name": display_name,
    }
    if description is not None:
        input_["description"] = description
    if type is not None:
        input_["type"] = type
    if tags is not None:
        input_["tags"] = tags
    if capacity_configuration is not None:
        input_["capacity_configuration"] = capacity_configuration
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output