def clone(
        self,
        *,
        index: str,
        target: str,
        aliases: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
        error_trace: t.Optional[bool] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        human: t.Optional[bool] = None,
        master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
        pretty: t.Optional[bool] = None,
        settings: t.Optional[t.Mapping[str, t.Any]] = None,
        timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
        wait_for_active_shards: t.Optional[
            t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
        ] = None,
        body: t.Optional[t.Dict[str, t.Any]] = None,
    ) -> ObjectApiResponse[t.Any]:
        """
        .. raw:: html

          <p>Clone an index.
          Clone an existing index into a new index.
          Each original primary shard is cloned into a new primary shard in the new index.</p>
          <p>IMPORTANT: Elasticsearch does not apply index templates to the resulting index.
          The API also does not copy index metadata from the original index.
          Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information.
          For example, if you clone a CCR follower index, the resulting clone will not be a follower index.</p>
          <p>The clone API copies most index settings from the source index to the resulting index, with the exception of <code>index.number_of_replicas</code> and <code>index.auto_expand_replicas</code>.
          To set the number of replicas in the resulting index, configure these settings in the clone request.</p>
          <p>Cloning works as follows:</p>
          <ul>
          <li>First, it creates a new target index with the same definition as the source index.</li>
          <li>Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.</li>
          <li>Finally, it recovers the target index as though it were a closed index which had just been re-opened.</li>
          </ul>
          <p>IMPORTANT: Indices can only be cloned if they meet the following requirements:</p>
          <ul>
          <li>The index must be marked as read-only and have a cluster health status of green.</li>
          <li>The target index must not exist.</li>
          <li>The source index must have the same number of primary shards as the target index.</li>
          <li>The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.</li>
          </ul>
          <p>The current write index on a data stream cannot be cloned.
          In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.</p>
          <p>NOTE: Mappings cannot be specified in the <code>_clone</code> request. The mappings of the source index will be used for the target index.</p>
          <p><strong>Monitor the cloning process</strong></p>
          <p>The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the <code>wait_for_status</code> parameter to <code>yellow</code>.</p>
          <p>The <code>_clone</code> API returns as soon as the target index has been added to the cluster state, before any shards have been allocated.
          At this point, all shards are in the state unassigned.
          If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.</p>
          <p>Once the primary shard is allocated, it moves to state initializing, and the clone process begins.
          When the clone operation completes, the shard will become active.
          At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.</p>
          <p><strong>Wait for active shards</strong></p>
          <p>Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.</p>


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

        :param index: Name of the source index to clone.
        :param target: Name of the target index to create.
        :param aliases: Aliases for the resulting index.
        :param master_timeout: Period to wait for a connection to the master node. If
            no response is received before the timeout expires, the request fails and
            returns an error.
        :param settings: Configuration options for the target index.
        :param timeout: Period to wait for a response. If no response is received before
            the timeout expires, the request fails and returns an error.
        :param wait_for_active_shards: The number of shard copies that must be active
            before proceeding with the operation. Set to `all` or any positive integer
            up to the total number of shards in the index (`number_of_replicas+1`).
        """
        if index in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'index'")
        if target in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'target'")
        __path_parts: t.Dict[str, str] = {
            "index": _quote(index),
            "target": _quote(target),
        }
        __path = f'/{__path_parts["index"]}/_clone/{__path_parts["target"]}'
        __query: t.Dict[str, t.Any] = {}
        __body: t.Dict[str, t.Any] = body if body is not None else {}
        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 master_timeout is not None:
            __query["master_timeout"] = master_timeout
        if pretty is not None:
            __query["pretty"] = pretty
        if timeout is not None:
            __query["timeout"] = timeout
        if wait_for_active_shards is not None:
            __query["wait_for_active_shards"] = wait_for_active_shards
        if not __body:
            if aliases is not None:
                __body["aliases"] = aliases
            if settings is not None:
                __body["settings"] = settings
        if not __body:
            __body = None  # type: ignore[assignment]
        __headers = {"accept": "application/json"}
        if __body is not None:
            __headers["content-type"] = "application/json"
        return self.perform_request(  # type: ignore[return-value]
            "PUT",
            __path,
            params=__query,
            headers=__headers,
            body=__body,
            endpoint_id="indices.clone",
            path_parts=__path_parts,
        )

        .. raw:: html

          <p>Clone an index.
          Clone an existing index into a new index.
          Each original primary shard is cloned into a new primary shard in the new index.</p>
          <p>IMPORTANT: Elasticsearch does not apply index templates to the resulting index.
          The API also does not copy index metadata from the original index.
          Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information.
          For example, if you clone a CCR follower index, the resulting clone will not be a follower index.</p>
          <p>The clone API copies most index settings from the source index to the resulting index, with the exception of <code>index.number_of_replicas</code> and <code>index.auto_expand_replicas</code>.
          To set the number of replicas in the resulting index, configure these settings in the clone request.</p>
          <p>Cloning works as follows:</p>
          <ul>
          <li>First, it creates a new target index with the same definition as the source index.</li>
          <li>Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.</li>
          <li>Finally, it recovers the target index as though it were a closed index which had just been re-opened.</li>
          </ul>
          <p>IMPORTANT: Indices can only be cloned if they meet the following requirements:</p>
          <ul>
          <li>The index must be marked as read-only and have a cluster health status of green.</li>
          <li>The target index must not exist.</li>
          <li>The source index must have the same number of primary shards as the target index.</li>
          <li>The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.</li>
          </ul>
          <p>The current write index on a data stream cannot be cloned.
          In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.</p>
          <p>NOTE: Mappings cannot be specified in the <code>_clone</code> request. The mappings of the source index will be used for the target index.</p>
          <p><strong>Monitor the cloning process</strong></p>
          <p>The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the <code>wait_for_status</code> parameter to <code>yellow</code>.</p>
          <p>The <code>_clone</code> API returns as soon as the target index has been added to the cluster state, before any shards have been allocated.
          At this point, all shards are in the state unassigned.
          If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.</p>
          <p>Once the primary shard is allocated, it moves to state initializing, and the clone process begins.
          When the clone operation completes, the shard will become active.
          At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.</p>
          <p><strong>Wait for active shards</strong></p>
          <p>Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.</p>


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

        :param index: Name of the source index to clone.
        :param target: Name of the target index to create.
        :param aliases: Aliases for the resulting index.
        :param master_timeout: Period to wait for a connection to the master node. If
            no response is received before the timeout expires, the request fails and
            returns an error.
        :param settings: Configuration options for the target index.
        :param timeout: Period to wait for a response. If no response is received before
            the timeout expires, the request fails and returns an error.
        :param wait_for_active_shards: The number of shard copies that must be active
            before proceeding with the operation. Set to `all` or any positive integer
            up to the total number of shards in the index (`number_of_replicas+1`).
        
elasticsearch/_sync/client/indices.py