> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Copy rules

> Copy the rules of an index to another index on the same app.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Copy or move an index" href="/doc/libraries/sdk/methods/search/operation-index" />

**Required ACL:** `editSettings`

This removes all index rules currently present in the destination index,
and replaces them with the rules from the source.

## Examples

<CodeGroup>
  ```cs C# theme={"system"}
  client.CopyRules("indexNameSrc", "indexNameDest");

  // Asynchronous
  client.CopyRulesAsync("indexNameSrc", "indexNameDest");
  ```

  ```go Go theme={"system"}
  res, err := client.CopyRules("indexNameSrc", "indexNameDest")
  ```

  ```java Java theme={"system"}
  client.copyRules("indexNameSrc", "indexNameDest");

  // Asynchronous
  client.copyRulesAsync("indexNameSrc", "indexNameDest");
  ```

  ```js JavaScript theme={"system"}
  client.copyRules('indexNameSrc', 'indexNameDest').then(() => {
    // done
  });
  ```

  ```kotlin Kotlin theme={"system"}
  index.copyRules(indexName)
  ```

  ```php PHP theme={"system"}
  $client->copyRules('indexNameSrc', 'indexNameDest');
  ```

  ```python Python theme={"system"}
  client.copy_rules('index_name_src', 'index_name_dest')
  ```

  ```ruby Ruby theme={"system"}
  client.copy_rules('index_name_src', 'index_name_dest')
  ```

  ```swift Swift theme={"system"}
  client.copyRules(from: "indexNameSrc", to: "indexNameDest") { result in
    if case .success(let response) = result {
      print("Response: \(response)")
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="indexNameDest" type="string" required>
  Name of the destination index.
</ParamField>

<ParamField body="indexNameSrc" type="string" required>
  Name of the source index to copy.
</ParamField>
