Manage Indices

List of methods

List indexes

Get a list of indexes with their associated metadata.

Delete index

Delete an index and all its settings, including replicas.

Copy index

Make a copy of an index, including its objects, settings, synonyms, and query rules.

Move index

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

Clear index

Clear the records of an index without affecting its settings.

Create an index

You don’t need to explicitly create an index, it will be automatically created the first time you add an object or set settings.

Asynchronous methods

All the manage indices methods are asynchronous. What you are actually doing when calling these methods is adding a new job to a queue: it is this job, and not the method, that actually performs the desired action. In most cases, the job is executed within seconds if not milliseconds. But it all depends on what is in the queue: if the queue has many pending tasks, the new job will need to wait its turn.

To help manage this asynchronicity, each method returns a unique task id which you can use with the waitTask method. Using the waitTask method guarantees that the job has finished before proceeding with your new requests. You will want to use this to manage dependencies, for example, when deleting an index before creating a new index with the same name, or clearing an index before adding new objects.

This is used most often in debugging scenarios where you are testing a search immediately after updating an index.

Analytics data

Analytics data is based on the index; to access analytics data, it is therefore necessary to use the index name. See the common parameters of our analytics methods.

We collect analytics data on a separate server, using separate processes. In parallel, your main indexes are updated and searched asynchronously. It is important to keep in mind that there is no hard link between your indexes and the collection and storage of their analytics data. they are 2 sets of data on separate servers. Therefore, actions like deleting or moving an index will have no impact on your Analytics data.

As a consequence, Analytics is not impacted by indexing methods. We do not remove analytics data: whether you have removed or changed the name of an index, its analytics can always be accessed using the original index name - even if the underlying index no longer exists.

Additionally, copying or moving an index will not transfer Analytics data from source to destination. The Analytics data stays on the source index, which is to be expected; and the destination index will not gain any new Analytics data.

Keep in mind, then, that if you are overwriting an exiting index - an index that already has analytics data - the overwritten index will not only not lose its Analytics data, any new Analytics data will be mixed-in with the old.