Skip to content

update_index

update_index(
    domain_name: DomainName,
    index_name: IndexName,
    index_schema: IndexSchema,
    *,
    config_overrides: Optional[OpenSearchClientConfig] = None,
) -> UpdateIndexResponse

Updates an existing OpenSearch index schema and semantic enrichment configuration. This operation allows modification of field mappings and semantic search settings for text fields. Changes to semantic enrichment configuration will apply to newly ingested documents.

Parameters:

  • index_name (IndexName) –

    The name of the index to update.

  • index_schema (IndexSchema) –

    The updated JSON schema for the index including any changes to mappings, settings, and semantic enrichment configuration.

Raises:

  • AccessDeniedException –

    An error occurred because you don't have permissions to access the resource.

  • DependencyFailureException –

    An exception for when a failure in one of the dependencies results in the service being unable to fetch details about the resource.

  • DisabledOperationException –

    An error occured because the client wanted to access an unsupported operation.

  • InternalException –

    Request processing failed because of an unknown error, exception, or internal failure.

  • ResourceNotFoundException –

    An exception for accessing or deleting a resource that doesn't exist.

  • ThrottlingException –

    The request was denied due to request throttling. Reduce the frequency of your requests and try again.

  • ValidationException –

    An exception for accessing or deleting a resource that doesn't exist.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_opensearch/_services/open_search.py
def update_index(
    self,
    domain_name: "capo_opensearch.types.domain_name.DomainName",
    index_name: "capo_opensearch.types.index_name.IndexName",
    index_schema: "capo_opensearch.types.index_schema.IndexSchema",
    *,
    config_overrides: Optional[OpenSearchClientConfig] = None,
) -> "capo_opensearch.types.update_index_response.UpdateIndexResponse":
    """<p>Updates an existing OpenSearch index schema and semantic enrichment configuration. This operation allows modification of field mappings and semantic search settings for text fields. Changes to semantic enrichment configuration will apply to newly ingested documents.</p>

    Args:
        index_name: <p>The name of the index to update.</p>
        index_schema: <p>The updated JSON schema for the index including any changes to mappings, settings, and semantic enrichment configuration.</p>

    Raises:
        capo_opensearch.errors.access_denied_exception.AccessDeniedException: <p>An error occurred because you don't have permissions to access the resource.</p>
        capo_opensearch.errors.dependency_failure_exception.DependencyFailureException: <p>An exception for when a failure in one of the dependencies results in the service being unable to fetch details about the resource.</p>
        capo_opensearch.errors.disabled_operation_exception.DisabledOperationException: <p>An error occured because the client wanted to access an unsupported operation.</p>
        capo_opensearch.errors.internal_exception.InternalException: <p>Request processing failed because of an unknown error, exception, or internal failure.</p>
        capo_opensearch.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of your requests and try again.</p>
        capo_opensearch.errors.validation_exception.ValidationException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_opensearch.types.update_index_request.UpdateIndexRequest]",
    ) -> OperationResponse[
        "capo_opensearch.types.update_index_response.UpdateIndexResponse"
    ]:
        import capo_opensearch._operations.amazon_open_search_service.update_index

        output, http_response = (
            capo_opensearch._operations.amazon_open_search_service.update_index.update_index(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateIndex")
    )
    input_: capo_opensearch.types.update_index_request.UpdateIndexRequest = {
        "domain_name": domain_name,
        "index_name": index_name,
        "index_schema": index_schema,
    }

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