Updates an existing index in an OpenSearch Serverless collection. This operation allows you to modify the index schema, including adding new fields or changing field mappings. You can also enable automatic semantic enrichment ingestion and search. For more information, see About automatic semantic enrichment.
Parameters:
-
id
(CollectionId)
–
The unique identifier of the collection containing the index to update.
-
index_name
(IndexName)
–
The name of the index to update.
-
index_schema
(Optional[IndexSchema], default:
None
)
–
The updated JSON schema definition for the index, including field mappings and settings.
Raises:
Source code in docs_src/capo_opensearchserverless/_services/async_open_search_serverless.py
| async def update_index(
self,
id: "capo_opensearchserverless.types.collection_id.CollectionId",
index_name: "capo_opensearchserverless.types.index_name.IndexName",
*,
config_overrides: Optional[AsyncOpenSearchServerlessClientConfig] = None,
index_schema: Optional[
"capo_opensearchserverless.types.index_schema.IndexSchema"
] = None,
) -> "capo_opensearchserverless.types.update_index_response.UpdateIndexResponse":
"""<p>Updates an existing index in an OpenSearch Serverless collection. This operation allows you to modify the index schema, including adding new fields or changing field mappings. You can also enable automatic semantic enrichment ingestion and search. For more information, see <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-manage.html#serverless-semantic-enrichment">About automatic semantic enrichment</a>.</p>
Args:
id: <p>The unique identifier of the collection containing the index to update.</p>
index_name: <p>The name of the index to update.</p>
index_schema: <p>The updated JSON schema definition for the index, including field mappings and settings. </p>
Raises:
capo_opensearchserverless.errors.internal_server_exception.InternalServerException: <p>Thrown when an error internal to the service occurs while processing a request.</p>
capo_opensearchserverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when accessing or deleting a resource that does not exist.</p>
capo_opensearchserverless.errors.validation_exception.ValidationException: <p>Thrown when the HTTP request contains invalid input or is missing required input.</p>
capo_opensearchserverless.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_opensearchserverless.types.update_index_request.UpdateIndexRequest]",
) -> AsyncOperationResponse[
"capo_opensearchserverless.types.update_index_response.UpdateIndexResponse"
]:
import capo_opensearchserverless._operations.open_search_serverless.update_index
(
output,
http_response,
) = await capo_opensearchserverless._operations.open_search_serverless.update_index.async_update_index(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateIndex")
)
input_: capo_opensearchserverless.types.update_index_request.UpdateIndexRequest = {
"id": id,
"index_name": index_name,
}
if index_schema is not None:
input_["index_schema"] = index_schema
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|