Skip to content

update_index_mode

update_index_mode(
    index_mode: IndexMode,
    *,
    config_overrides: Optional[S3VectorsClientConfig] = None,
    vector_bucket_name: Optional[VectorBucketName] = None,
    index_name: Optional[IndexName] = None,
    index_arn: Optional[IndexArn] = None,
) -> UpdateIndexModeOutput

Updates the mode for an existing vector index. You can set the mode to ENHANCED for any vector index. You can set the mode to CLASSIC only for a vector index in a vector bucket created before September 30, 2026. This operation doesn't change the default index mode of the vector bucket or the mode of other vector indexes. Specify the vector index by using its Amazon Resource Name (ARN) or both the vector bucket name and vector index name.

Permissions

You must have the s3vectors:UpdateIndexMode permission to use this operation.

Parameters:

  • vector_bucket_name (Optional[VectorBucketName], default: None ) –

    The name of the vector bucket that contains the vector index.

  • index_name (Optional[IndexName], default: None ) –

    The name of the vector index to update.

  • index_arn (Optional[IndexArn], default: None ) –

    The Amazon Resource Name (ARN) of the vector index to update.

  • index_mode (IndexMode) –

    The new mode for the vector index.

    Valid values:

    • CLASSIC - Applies metadata filters during the vector search. You can specify CLASSIC only for a vector index in a vector bucket created before September 30, 2026.

    • ENHANCED - Applies metadata filters before the vector search.

Raises:

Source code in docs_src/capo_s3vectors/_services/s3_vectors.py
def update_index_mode(
    self,
    index_mode: "capo_s3vectors.types.index_mode.IndexMode",
    *,
    config_overrides: Optional[S3VectorsClientConfig] = None,
    vector_bucket_name: Optional[
        "capo_s3vectors.types.vector_bucket_name.VectorBucketName"
    ] = None,
    index_name: Optional["capo_s3vectors.types.index_name.IndexName"] = None,
    index_arn: Optional["capo_s3vectors.types.index_arn.IndexArn"] = None,
) -> "capo_s3vectors.types.update_index_mode_output.UpdateIndexModeOutput":
    """<p>Updates the mode for an existing vector index. You can set the mode to <code>ENHANCED</code> for any vector index. You can set the mode to <code>CLASSIC</code> only for a vector index in a vector bucket created before September 30, 2026. This operation doesn't change the default index mode of the vector bucket or the mode of other vector indexes. Specify the vector index by using its Amazon Resource Name (ARN) or both the vector bucket name and vector index name.</p> <dl> <dt>Permissions</dt> <dd> <p>You must have the <code>s3vectors:UpdateIndexMode</code> permission to use this operation.</p> </dd> </dl>

    Args:
        vector_bucket_name: <p>The name of the vector bucket that contains the vector index.</p>
        index_name: <p>The name of the vector index to update.</p>
        index_arn: <p>The Amazon Resource Name (ARN) of the vector index to update.</p>
        index_mode: <p>The new mode for the vector index.</p> <p>Valid values:</p> <ul> <li> <p> <code>CLASSIC</code> - Applies metadata filters during the vector search. You can specify <code>CLASSIC</code> only for a vector index in a vector bucket created before September 30, 2026.</p> </li> <li> <p> <code>ENHANCED</code> - Applies metadata filters before the vector search.</p> </li> </ul>

    Raises:
        capo_s3vectors.errors.access_denied_exception.AccessDeniedException: <p>Access denied.</p>
        capo_s3vectors.errors.internal_server_exception.InternalServerException: <p>The request failed due to an internal server error.</p>
        capo_s3vectors.errors.request_timeout_exception.RequestTimeoutException: <p>The request timed out. Retry your request.</p>
        capo_s3vectors.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was denied due to request throttling.</p>
        capo_s3vectors.errors.validation_exception.ValidationException: <p>The requested action isn't valid.</p>
        capo_s3vectors.errors.not_found_exception.NotFoundException: <p>The request was rejected because the specified resource can't be found.</p>
        capo_s3vectors.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unavailable. Wait briefly and retry your request. If it continues to fail, increase your waiting time between retries.</p>
        capo_s3vectors.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_s3vectors.types.update_index_mode_input.UpdateIndexModeInput]",
    ) -> OperationResponse[
        "capo_s3vectors.types.update_index_mode_output.UpdateIndexModeOutput"
    ]:
        import capo_s3vectors._operations.s3_vectors.update_index_mode

        output, http_response = (
            capo_s3vectors._operations.s3_vectors.update_index_mode.update_index_mode(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateIndexMode")
    )
    input_: capo_s3vectors.types.update_index_mode_input.UpdateIndexModeInput = {
        "index_mode": index_mode
    }
    if vector_bucket_name is not None:
        input_["vector_bucket_name"] = vector_bucket_name
    if index_name is not None:
        input_["index_name"] = index_name
    if index_arn is not None:
        input_["index_arn"] = index_arn

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