async def delete(
        self,
        *,
        index: str,
        id: str,
        error_trace: t.Optional[bool] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        human: t.Optional[bool] = None,
        if_primary_term: t.Optional[int] = None,
        if_seq_no: t.Optional[int] = None,
        pretty: t.Optional[bool] = None,
        refresh: t.Optional[
            t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
        ] = None,
        routing: t.Optional[str] = None,
        timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
        version: t.Optional[int] = None,
        version_type: t.Optional[
            t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
        ] = None,
        wait_for_active_shards: t.Optional[
            t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
        ] = None,
    ) -> ObjectApiResponse[t.Any]:
        """
        .. raw:: html

          <p>Delete a document.</p>
          <p>Remove a JSON document from the specified index.</p>
          <p>NOTE: You cannot send deletion requests directly to a data stream.
          To delete a document in a data stream, you must target the backing index containing the document.</p>
          <p><strong>Optimistic concurrency control</strong></p>
          <p>Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the <code>if_seq_no</code> and <code>if_primary_term</code> parameters.
          If a mismatch is detected, the operation will result in a <code>VersionConflictException</code> and a status code of <code>409</code>.</p>
          <p><strong>Versioning</strong></p>
          <p>Each document indexed is versioned.
          When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime.
          Every write operation run on a document, deletes included, causes its version to be incremented.
          The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations.
          The length of time for which a deleted document's version remains available is determined by the <code>index.gc_deletes</code> index setting.</p>
          <p><strong>Routing</strong></p>
          <p>If routing is used during indexing, the routing value also needs to be specified to delete a document.</p>
          <p>If the <code>_routing</code> mapping is set to <code>required</code> and no routing value is specified, the delete API throws a <code>RoutingMissingException</code> and rejects the request.</p>
          <p>For example:</p>
          <pre><code>DELETE /my-index-000001/_doc/1?routing=shard-1
          </code></pre>
          <p>This request deletes the document with ID 1, but it is routed based on the user.
          The document is not deleted if the correct routing is not specified.</p>
          <p><strong>Distributed</strong></p>
          <p>The delete operation gets hashed into a specific shard ID.
          It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete>`_

        :param index: The name of the target index.
        :param id: A unique identifier for the document.
        :param if_primary_term: Only perform the operation if the document has this primary
            term.
        :param if_seq_no: Only perform the operation if the document has this sequence
            number.
        :param refresh: If `true`, Elasticsearch refreshes the affected shards to make
            this operation visible to search. If `wait_for`, it waits for a refresh to
            make this operation visible to search. If `false`, it does nothing with refreshes.
        :param routing: A custom value used to route operations to a specific shard.
        :param timeout: The period to wait for active shards. This parameter is useful
            for situations where the primary shard assigned to perform the delete operation
            might not be available when the delete operation runs. Some reasons for this
            might be that the primary shard is currently recovering from a store or undergoing
            relocation. By default, the delete operation will wait on the primary shard
            to become available for up to 1 minute before failing and responding with
            an error.
        :param version: An explicit version number for concurrency control. It must match
            the current version of the document for the request to succeed.
        :param version_type: The version type.
        :param wait_for_active_shards: The minimum number of shard copies that must be
            active before proceeding with the operation. You can set it to `all` or any
            positive integer up to the total number of shards in the index (`number_of_replicas+1`).
            The default value of `1` means it waits for each primary shard to be active.
        """
        if index in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'index'")
        if id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'id'")
        __path_parts: t.Dict[str, str] = {"index": _quote(index), "id": _quote(id)}
        __path = f'/{__path_parts["index"]}/_doc/{__path_parts["id"]}'
        __query: t.Dict[str, t.Any] = {}
        if error_trace is not None:
            __query["error_trace"] = error_trace
        if filter_path is not None:
            __query["filter_path"] = filter_path
        if human is not None:
            __query["human"] = human
        if if_primary_term is not None:
            __query["if_primary_term"] = if_primary_term
        if if_seq_no is not None:
            __query["if_seq_no"] = if_seq_no
        if pretty is not None:
            __query["pretty"] = pretty
        if refresh is not None:
            __query["refresh"] = refresh
        if routing is not None:
            __query["routing"] = routing
        if timeout is not None:
            __query["timeout"] = timeout
        if version is not None:
            __query["version"] = version
        if version_type is not None:
            __query["version_type"] = version_type
        if wait_for_active_shards is not None:
            __query["wait_for_active_shards"] = wait_for_active_shards
        __headers = {"accept": "application/json"}
        return await self.perform_request(  # type: ignore[return-value]
            "DELETE",
            __path,
            params=__query,
            headers=__headers,
            endpoint_id="delete",
            path_parts=__path_parts,
        )

        .. raw:: html

          <p>Delete a document.</p>
          <p>Remove a JSON document from the specified index.</p>
          <p>NOTE: You cannot send deletion requests directly to a data stream.
          To delete a document in a data stream, you must target the backing index containing the document.</p>
          <p><strong>Optimistic concurrency control</strong></p>
          <p>Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the <code>if_seq_no</code> and <code>if_primary_term</code> parameters.
          If a mismatch is detected, the operation will result in a <code>VersionConflictException</code> and a status code of <code>409</code>.</p>
          <p><strong>Versioning</strong></p>
          <p>Each document indexed is versioned.
          When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime.
          Every write operation run on a document, deletes included, causes its version to be incremented.
          The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations.
          The length of time for which a deleted document's version remains available is determined by the <code>index.gc_deletes</code> index setting.</p>
          <p><strong>Routing</strong></p>
          <p>If routing is used during indexing, the routing value also needs to be specified to delete a document.</p>
          <p>If the <code>_routing</code> mapping is set to <code>required</code> and no routing value is specified, the delete API throws a <code>RoutingMissingException</code> and rejects the request.</p>
          <p>For example:</p>
          <pre><code>DELETE /my-index-000001/_doc/1?routing=shard-1
          </code></pre>
          <p>This request deletes the document with ID 1, but it is routed based on the user.
          The document is not deleted if the correct routing is not specified.</p>
          <p><strong>Distributed</strong></p>
          <p>The delete operation gets hashed into a specific shard ID.
          It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete>`_

        :param index: The name of the target index.
        :param id: A unique identifier for the document.
        :param if_primary_term: Only perform the operation if the document has this primary
            term.
        :param if_seq_no: Only perform the operation if the document has this sequence
            number.
        :param refresh: If `true`, Elasticsearch refreshes the affected shards to make
            this operation visible to search. If `wait_for`, it waits for a refresh to
            make this operation visible to search. If `false`, it does nothing with refreshes.
        :param routing: A custom value used to route operations to a specific shard.
        :param timeout: The period to wait for active shards. This parameter is useful
            for situations where the primary shard assigned to perform the delete operation
            might not be available when the delete operation runs. Some reasons for this
            might be that the primary shard is currently recovering from a store or undergoing
            relocation. By default, the delete operation will wait on the primary shard
            to become available for up to 1 minute before failing and responding with
            an error.
        :param version: An explicit version number for concurrency control. It must match
            the current version of the document for the request to succeed.
        :param version_type: The version type.
        :param wait_for_active_shards: The minimum number of shard copies that must be
            active before proceeding with the operation. You can set it to `all` or any
            positive integer up to the total number of shards in the index (`number_of_replicas+1`).
            The default value of `1` means it waits for each primary shard to be active.
        
elasticsearch/_async/client/__init__.py