API Reference / API Methods / Manage indices / Move index
Feb. 26, 2019

Move index

Required API Key: any key with the addObject ACL
Method signature
$client->moveIndex(
  string indexNameSrc,
  string indexNameDest
);

About this method

Rename an index. Normally used to reindex your data atomically, without any down time.

The move index method is a safe and atomic way to rename an index.

By using this method, you can keep your existing service running while the data from the old index is being imported into the new index.

Moving an index overrides the objects and settings of the destination index.

Regarding replicas:

  • Moving to an index having replicas is possible, it will replace the destination index data with the source index data, and the data will be propagated to the replicas
  • Moving an index having replicas is not possible, as it would break the relationship with its replicas

Moving an index will have no impact on Analytics data because you cannot move an index’s Analytics data.

Examples

Move index

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

Parameters

indexNameSrc
type: string
Required

Index name of the index to move.

indexNameDest
type: string
Required

Index name of the destination index.

indexSrc
type: object
Required

Source index object.

indexDest
type: object
Required

Destination index object.

Response

In this section we document the JSON response returned by the API. Each language will encapsulate this response inside objects specific to the language and/or the implementation. So the actual type in your language might differ from what is documented.

JSON format

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

Date at which the job to copy the index has been created.

taskID
integer

This is the taskID which is used with the waitTask method.

Note You can use either the source or destination index to wait on the resulting taskID. In either case, the wait will include the full copy process.

Did you find this page helpful?