Reputation: 1855
The documentation recommends the following function to delete a specific index:
client.delete({
index: 'myindex',
type: 'mytype',
id: '1'
}, function (error, response) {
// ...
});
Which I have adapted to:
client.delete({
index: '_all'
}, function (error, response) {
// ...
});
But that gives me the following error:
Unable to build a path with those params. Supply at least index, type, id
I've been searching around for a couple of hours to no avail, anyone have any ideas?
Upvotes: 20
Views: 16328
Reputation: 1855
So, turns out I was using the wrong method. The below should take care of deleting all the indexes.
client.indices.delete({
index: '_all'
}, function(err, res) {
if (err) {
console.error(err.message);
} else {
console.log('Indexes have been deleted!');
}
});
You can introduce specific index names within that 'index' parameter, and you can also use '*' as an alternate to '_all'.
Upvotes: 33