如何删除使用node.js的弹性search中的所有索引?

该文档build议使用以下function删除特定索引:

client.delete({ index: 'myindex', type: 'mytype', id: '1' }, function (error, response) { // ... }); 

我已经适应了:

 client.delete({ index: '_all' }, function (error, response) { // ... }); 

但是,这给了我以下错误:

 Unable to build a path with those params. Supply at least index, type, id 

我一直在寻找几个小时无济于事,任何人有任何想法?

所以,事实certificate我正在使用错误的方法。 下面应该注意删除所有的索引。

 client.indices.delete({ index: '_all' }, function(err, res) { if (err) { console.error(err.message); } else { console.log('Indexes have been deleted!'); } }); 

您可以在'index'参数中引入特定的索引名称,也可以使用'*'作为'_all'的替代。