> ## 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 or move an index

> Copies or moves (renames) an index within the same Algolia application.

**Required ACL:** `addObject`

Notes:

* Existing destination indices are overwritten, except for their analytics data.
* If the destination index doesn't exist yet, it's created.
* This operation is resource-intensive.

**Copy**

* If the source index doesn't exist, copying creates a new index with 0 records and default settings.
* API keys from the source index are merged with the existing keys in the destination index.
* You can't copy the `enableReRanking`, `mode`, and `replicas` settings.
* You can't copy to a destination index that already has replicas.
* Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits).
* For more information, see [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices).

**Move**

* If the source index doesn't exist, moving is ignored without returning an error.
* When moving an index, the analytics data keeps its original name, and a new set of analytics data is started for the new name.
  To access the original analytics in the dashboard, create an index with the original name.
* If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices.
* For more information, see [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices).

This operation is subject to [indexing rate limits](https://support.algolia.com/hc/articles/4406975251089-Is-there-a-rate-limit-for-indexing-on-Algolia).

## Usage

<CodeGroup>
  ```cs C# theme={"system"}
  // Initialize the client
  var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));

  // Call the API
  var response = await client.OperationIndexAsync(
    "<SOURCE_INDEX_NAME>",
    new OperationIndexParams
    {
      Operation = Enum.Parse<OperationType>("Move"),
      Destination = "<DESTINATION_INDEX_NAME>",
      Scope = new List<ScopeType>
      {
        Enum.Parse<ScopeType>("Rules"),
        Enum.Parse<ScopeType>("Settings"),
      },
    }
  );

  // print the response
  Console.WriteLine(response);
  ```

  ```dart Dart theme={"system"}
  // Initialize the client
  final client =
      SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');

  // Call the API
  final response = await client.operationIndex(
    indexName: "<SOURCE_INDEX_NAME>",
    operationIndexParams: OperationIndexParams(
      operation: OperationType.fromJson("move"),
      destination: "<DESTINATION_INDEX_NAME>",
      scope: [
        ScopeType.fromJson("rules"),
        ScopeType.fromJson("settings"),
      ],
    ),
  );

  // print the response
  print(response);
  ```

  ```go Go theme={"system"}
  // Initialize the client
  client, err := search.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
  if err != nil {
    // The client can fail to initialize if you pass an invalid parameter.
    panic(err)
  }

  // Call the API
  response, err := client.OperationIndex(client.NewApiOperationIndexRequest(
    "<SOURCE_INDEX_NAME>",
    search.NewEmptyOperationIndexParams().SetOperation(search.OperationType("move")).SetDestination("<DESTINATION_INDEX_NAME>").SetScope(
      []search.ScopeType{search.ScopeType("rules"), search.ScopeType("settings")})))
  if err != nil {
    // handle the eventual error
    panic(err)
  }


  // print the response
  print(response)
  ```

  ```java Java theme={"system"}
  // Initialize the client
  SearchClient client = new SearchClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

  // Call the API
  UpdatedAtResponse response = client.operationIndex(
    "<SOURCE_INDEX_NAME>",
    new OperationIndexParams()
      .setOperation(OperationType.MOVE)
      .setDestination("<DESTINATION_INDEX_NAME>")
      .setScope(Arrays.asList(ScopeType.RULES, ScopeType.SETTINGS))
  );

  // print the response
  System.out.println(response);
  ```

  ```js JavaScript theme={"system"}
  // Initialize the client
  const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

  // Call the API
  const response = await client.operationIndex({
    indexName: '<SOURCE_INDEX_NAME>',
    operationIndexParams: { operation: 'move', destination: '<DESTINATION_INDEX_NAME>', scope: ['rules', 'settings'] },
  });


  // print the response
  console.log(response);
  ```

  ```kotlin Kotlin theme={"system"}
  // Initialize the client
  val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

  // Call the API
  var response =
    client.operationIndex(
      indexName = "<SOURCE_INDEX_NAME>",
      operationIndexParams =
        OperationIndexParams(
          operation = OperationType.entries.first { it.value == "move" },
          destination = "<DESTINATION_INDEX_NAME>",
          scope =
            listOf(
              ScopeType.entries.first { it.value == "rules" },
              ScopeType.entries.first { it.value == "settings" },
            ),
        ),
    )


  // print the response
  println(response)
  ```

  ```php PHP theme={"system"}
  // Initialize the client
  $client = SearchClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

  // Call the API
  $response = $client->operationIndex(
      '<SOURCE_INDEX_NAME>',
      ['operation' => 'move',
          'destination' => '<DESTINATION_INDEX_NAME>',
          'scope' => [
              'rules',

              'settings',
          ],
      ],
  );


  // print the response
  var_dump($response);
  ```

  ```python Python theme={"system"}
  # Initialize the client
  # In an asynchronous context, you can use SearchClient instead, which exposes the exact same methods.
  client = SearchClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

  # Call the API
  response = client.operation_index(
      index_name="<SOURCE_INDEX_NAME>",
      operation_index_params={
          "operation": "move",
          "destination": "<DESTINATION_INDEX_NAME>",
          "scope": [
              "rules",
              "settings",
          ],
      },
  )


  # print the response
  print(response)
  ```

  ```ruby Ruby theme={"system"}
  # Initialize the client
  client = Algolia::SearchClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

  # Call the API
  response = client.operation_index(
    "<SOURCE_INDEX_NAME>",
    Algolia::Search::OperationIndexParams.new(
      operation: "move",
      destination: "<DESTINATION_INDEX_NAME>",
      scope: ["rules", "settings"]
    )
  )


  # print the response
  puts(response)
  ```

  ```scala Scala theme={"system"}
  // Initialize the client
  val client = SearchClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

  // Call the API
  val response = Await.result(
    client.operationIndex(
      indexName = "<SOURCE_INDEX_NAME>",
      operationIndexParams = OperationIndexParams(
        operation = OperationType.withName("move"),
        destination = "<DESTINATION_INDEX_NAME>",
        scope = Some(Seq(ScopeType.withName("rules"), ScopeType.withName("settings")))
      )
    ),
    Duration(100, "sec")
  )

  // print the response
  println(response)
  ```

  ```swift Swift theme={"system"}
  // Initialize the client
  let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")

  // Call the API
  let response = try await client.operationIndex(
      indexName: "<SOURCE_INDEX_NAME>",
      operationIndexParams: OperationIndexParams(
          operation: OperationType.move,
          destination: "<DESTINATION_INDEX_NAME>",
          scope: [ScopeType.rules, ScopeType.settings]
      )
  )

  // print the response
  print(response)
  ```
</CodeGroup>

<Card icon="folder-code" horizontal="true" title="See the full API reference" arrow="true" href="/doc/rest-api/search/operation-index">
  For more details about input parameters
  and response fields.
</Card>
