Skip to content

define_index_field async

define_index_field(
    domain_name: DomainName,
    index_field: IndexField,
    *,
    config_overrides: Optional[AsyncCloudSearchClientConfig] = None,
) -> DefineIndexFieldResponse

Configures an IndexField for the search domain. Used to create new fields and modify existing ones. You must specify the name of the domain you are configuring and an index field configuration. The index field configuration specifies a unique name, the index field type, and the options you want to configure for the field. The options you can specify depend on the IndexFieldType. If the field exists, the new configuration replaces the old one. For more information, see Configuring Index Fields in the Amazon CloudSearch Developer Guide.

Parameters:

  • index_field (IndexField) –

    The index field and field options you want to configure.

Raises:

Source code in docs_src/capo_cloudsearch/_services/async_cloud_search.py
async def define_index_field(
    self,
    domain_name: "capo_cloudsearch.types.domain_name.DomainName",
    index_field: "capo_cloudsearch.types.index_field.IndexField",
    *,
    config_overrides: Optional[AsyncCloudSearchClientConfig] = None,
) -> "capo_cloudsearch.types.define_index_field_response.DefineIndexFieldResponse":
    """<p>Configures an <code><a>IndexField</a></code> for the search domain. Used to create new fields and modify existing ones. You must specify the name of the domain you are configuring and an index field configuration. The index field configuration specifies a unique name, the index field type, and the options you want to configure for the field. The options you can specify depend on the <code><a>IndexFieldType</a></code>. If the field exists, the new configuration replaces the old one. For more information, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-index-fields.html" target="_blank">Configuring Index Fields</a> in the <i>Amazon CloudSearch Developer Guide</i>. </p>

    Args:
        index_field: <p>The index field and field options you want to configure. </p>

    Raises:
        capo_cloudsearch.errors.base_exception.BaseException: <p>An error occurred while processing the request.</p>
        capo_cloudsearch.errors.internal_exception.InternalException: <p>An internal error occurred while processing the request. If this problem persists, report an issue from the <a href="http://status.aws.amazon.com/" target="_blank">Service Health Dashboard</a>.</p>
        capo_cloudsearch.errors.invalid_type_exception.InvalidTypeException: <p>The request was rejected because it specified an invalid type definition.</p>
        capo_cloudsearch.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because a resource limit has already been met.</p>
        capo_cloudsearch.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because it attempted to reference a resource that does not exist.</p>
        capo_cloudsearch.errors.validation_exception.ValidationException: <p>The request was rejected because it has invalid parameters.</p>
        capo_cloudsearch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudsearch.types.define_index_field_request.DefineIndexFieldRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudsearch.types.define_index_field_response.DefineIndexFieldResponse"
    ]:
        import capo_cloudsearch._operations.a9_search_cloud_config_service2013.define_index_field

        (
            output,
            http_response,
        ) = await capo_cloudsearch._operations.a9_search_cloud_config_service2013.define_index_field.async_define_index_field(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DefineIndexField")
    )
    input_: capo_cloudsearch.types.define_index_field_request.DefineIndexFieldRequest = {
        "domain_name": domain_name,
        "index_field": index_field,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output