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

# Move index

> Move or rename an index.

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:** `addObject`

Using this method, you can keep your existing service running while data from the old index is added to the new index. Moving doesn't trigger a complete rebuild of the destination index unless it has replicas.

**Moving an index is expensive and is [rate-limited](https://support.algolia.com/hc/en-us/articles/4406975251089#when-do-we-trigger-the-rate-limit):**

* If you have more than 100 pending requests, the engine throttles your requests.
* If you have more than 5,000 pending requests, further requests are ignored.

### Analytics

If an index has analytics data, renaming doesn't erase it but [be aware of the consequences](https://beta.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics):

* The destination's analytics keep their original name
* A new set of analytics is started with the new name.

**To access the original analytics in the dashboard's Analytics menu, first create a new empty index with the original index name.**

<Info>
  **If your source index doesn't exist**, the move operation is ignored.
  You can still use [`waitTask`](/doc/libraries/sdk/v1/methods/wait-task) for this job.
</Info>

### Move indices between apps

To move an index between apps, use the [`copyIndex` method](/doc/libraries/sdk/v1/methods/copy-index#copy-index-between-apps).

### Move from and to replicas

**You can move a source index to a destination index that has replicas.**
The process replaces the destination index with the source index ,
and copies the source data to its replicas.

**You can't move a source index that has replicas**.

## Examples

### Move index

<CodeGroup>
  ```cs C# theme={"system"}
  // Use an API key with `addObject` ACL
  var client = new SearchClient("YourApplicationID", "YourAPIKey");

  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  client.MoveIndex("indexNameSrc", "indexNameDest");

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

  ```go Go theme={"system"}
  // Use an API key with `addObject` ACL
  client := search.NewClient("YourApplicationID", "YourAPIKey")

  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  res, err := client.MoveIndex("indexNameSrc", "indexNameDest")
  ```

  ```java Java theme={"system"}
  // Use an API key with `addObject` ACL
  SearchClient client = DefaultSearchClient.create("YourApplicationID", "YourAPIKey");

  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  client.moveIndex("indexNameSrc", "indexNameDest");

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

  ```js JavaScript theme={"system"}
  const algoliasearch = require('algoliasearch');

  // Use an API key with `addObject` ACL
  const client = algoliasearch('YourApplicationID', 'YourAPIKey');

  // Rename indexNameSrc to indexNameDest (and overwrite it)
  client.moveIndex('indexNameSrc', 'indexNameDest');
  ```

  ```kotlin Kotlin theme={"system"}
  // Use an API key with `addObject` ACL
  val client = ClientSearch(
    ApplicationID("YourApplicationID")
    APIKey("YourAPIKey")
  )
  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  val index = client.initIndex(IndexName("indexNameSrc"))
  index.moveIndex(IndexName("indexNameDest"))
  ```

  ```php PHP theme={"system"}
  <?php
  require_once __DIR__."/vendor/autoload.php";
  use Algolia\AlgoliaSearch\SearchClient;

  // Use an API key with `addObject` ACL
  $client = SearchClient::create(
    'YourApplicationID', 'YourAPIKey'
  );

  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  $index = $client->moveIndex('indexNameSrc', 'indexNameDest');
  ```

  ```python Python theme={"system"}
  from algoliasearch.search_client import SearchClient

  # Use an API key with `addObject` ACL
  client = SearchClient.create("YourApplicationID", "YourAPIKey")

  # Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  client.move_index("indexNameSrc", "indexNameDest")
  ```

  ```ruby Ruby theme={"system"}
  require 'algolia'

  # Use an API key with `addObject` ACL
  client = Algolia::Search::Client.create(
    'YourApplicationID', 'YourAPIKey'
  )

  # Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  client.move_index('indexNameSrc', 'indexNameDest')
  ```

  ```scala Scala theme={"system"}
  // Use an API key with `addObject` ACL
  val client = new AlgoliaClient("YourApplicationID", "YourAPIKey")

  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  client.execute { move index "indexNameSrc" to "indexNameDest" }
  ```

  ```swift Swift theme={"system"}
  import AlgoliaSearchClient

  // Use an API key with `addObject` ACL
  let client = SearchClient(
    appID: "YourApplicationID",
    apiKey: "YourAPIKey"
  )

  // Rename `indexNameSrc` to `indexNameDest` (and overwrite it)
  client.moveIndex(from: "indexNameSrc", to: "indexNameDest") { result in
    if case .success(let response) = result {
      print("Response: \(response)")
    }
  }
  ```
</CodeGroup>

## Parameters

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

<ParamField body="indexNameSrc" type="string" required>
  Index name of the index to move.
</ParamField>

## Response

<ResponseField name="taskID" type="integer">
  The `taskID` used with the [`waitTask`](/doc/libraries/sdk/v1/methods/wait-task) method.

  <Info>
    You can use either the source or destination index to wait on the resulting `taskID`. In either case, the wait includes the entire copy process.
  </Info>
</ResponseField>

<ResponseField name="updatedAt" type="string">
  The date, in [Unix timestamp format](/doc/guides/sending-and-managing-data/prepare-your-data/in-depth/what-is-in-a-record#dates), when the job to copy the index was created.
</ResponseField>

### Response as JSON

This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the `getLogs` method.
Don't rely on the order of properties—JSON objects don't preserve key order.

```jsonc JSON icon=braces theme={"system"}
{
  "updatedAt": "2017-12-18T21:22:40.761Z",
  "taskID": 19541511530
}
```
