Delete index

Required API Key: any key with the deleteIndex ACL
Method signature
$client->deleteIndex(indexName)
Method signature
client.delete_index(indexName)
Method signature
client.deleteIndex(indexName, callback)
Method signature
client.delete_index(indexName)
Method signature
client.deleteIndex(indexName, completionHandler)
Method signature
client.deleteIndexAsync(indexName, completionHandler)
Method signature
client.DeleteIndex(indexName)
Method signature
client.deleteIndex(indexName)
Method signature
index.Delete(indexName)
Method signature
delete.index(indexName)

About this method

Delete an index and all its settings, including links to its replicas.

This method not only removes an index from your application, it also removes its metadata and configured settings (like searchable attributes or custom ranking).

If the index has replicas, they will be preserved but will no longer be linked to their primary index. Instead, they’ll become independent indices.

If you want to only remove the records from the index, use the clear method.

Deleting an index will have no impact on Analytics data because you cannot delete an index’s Analytics data.

Examples

Delete an index by name

<?php
$client->deleteIndex('contacts');
index.delete_index('contacts')
client.deleteIndex('contacts', function(err, content) {
  if (err) throw err;

  console.log('success');
});
client.delete_index("contacts")
client.deleteIndex(
  withName: "contacts",
  completionHandler: { (content, error) -> Void in
    if error != nil {
        print("Could not delete: \(error!)")
    }
  }
)
client.deleteIndexAsync("contacts", null);
client.DeleteIndex("contacts");

// Asynchronous
// await client.DeleteIndexAsync("contacts");
//Sync version
Index contacts = client.initIndex("contacts");
contacts.delete();
// or client.deleteIndex("contacts")


//Async version
AsyncIndex contacts = client.initIndex("contacts");
contacts.delete();
// or client.deleteIndex("contacts")
res, err := index.Delete()
client.execute { delete index "index" }

Parameters

indexName
type: string
Required

Name of the index to be deleted.

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

{
  "deletedAt": "2017-12-18T21:22:40.761Z",
  "taskID": 19541511530
}
deletedAt
string

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

taskID
integer

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

Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala