Required API Key: any key with the deleteIndex ACL
Method signature
$index->clearIndex()
Method signature
index.clear_index()
Method signature
index.clearIndex(callback)
Method signature
index.clear_index()
Method signature
index.clearIndex(completionHandler)
Method signature
index.clearIndexAsync(completionHandler)
Method signature
index.ClearIndex()
Method signature
index.clear()
Method signature
index.Clear()
Method signature
clear.index("indexName")

About this method

Clear the records of an index without affecting its settings.

This method enables you to delete an index’s contents (records) without removing any settings, rules and synonyms.

If you want to remove the entire index and not just its records, use the delete method instead.

Clearing an index will have no impact on its Analytics data because you cannot clear an index’s analytics data.

Examples

<?php
$index->clearIndex();
index.clear_index
index.clearIndex(function(err, content) {
  if (err) throw err;

  console.log(content);
});
index.clear_index()
index.clearIndex(completionHandler: { (content, error) -> Void in
    if error != nil {
        print("Could not clear index: \(error!)")
    }
})
index.clearIndexAsync(null);
index.ClearIndex();

// Asynchronous
// await index.ClearIndexAsync();
// Sync & Async version
index.clear();
res, err := index.Clear()
client.execute { clear index "index" }

Parameters

No parameters for this method.

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

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

Date at which the job to clear 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