使用终端中的Id从ElasticSearch删除索引

时间:2015-07-23 06:51:47

标签: elasticsearch ujson

以下是我想要从ElasticSeach中删除的索引的UJSON(Ultra JSON)对象

xlsxj = require("xlsx-to-json");
app.post('/upload' function(req, res) {
/* upload script here */

  xlsxj({
      input: "sample.xlsx", //change this names based on the upload file name
      output: "output.json"
    }, function(err, result) {
      if(err) {
        console.error(err);
      }else {
        console.log(result);
      }
  });
});

我想通过传递id“fubarId”来删除这个索引。给我提供从终端删除它的查询

  

注意:我使用UJSON存储和检索

1 个答案:

答案 0 :(得分:1)

您可以使用Delete API删除单个文档:

curl -XDELETE localhost:9200/index/type/docId

在上面的情况中,您将使用此:

curl -XDELETE localhost:9200/fubar/ratings/fubarId