API Reference / API Methods / Manage indices / Move index
Required API Key: any key with the addObject ACL
Method signature
$client->moveIndex(
  string indexNameSrc,
  string indexNameDest
);

About this method # A

Renames an index. This is used internally to reindex your data without any downtime.

Using this method, you can keep your existing service running while data from the old index imports into the new index. It doesn’t trigger a complete rebuild of the destination index unless it has replicas.

Moving an index is an “expensive” operation, and is rate-limited. 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:

  • 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 blank index with the original index name.

During a move operation, if your source index doesn’t exist, the operation is ignored. You can still perform a waitTask for this job.

Moving indices between apps#

To move an index between apps, use the copyIndex method.

Moving from and to replicas#

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

You can’t move from a source index that has replicas, as it would break the relationship with its replicas.

Examples # A

Move index#

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

Parameters # A

indexNameSrc #
type: string
Required

Index name of the index to move.

indexNameDest #
type: string
Required

Index name of the destination index.

Response # A

This section shows the JSON response returned by the API. Since each language encapsulates this response inside objects specific to that language and/or implementation, the actual type in your language might differ from what’s written here. You can view the response in the logs (using the getLogs method).

JSON format#

1
2
3
4
{
  "updatedAt": "2017-12-18T21:22:40.761Z",
  "taskID": 19541511530
}
updatedAt #
string

The date, in Unix timestamp format, when the job to copy the index was created.

taskID #
integer

The taskID used with the waitTask method.

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.

Did you find this page helpful?
PHP v3