删除索引

现在,让我们删除我们刚刚创建,然后再列出所有的索引:


curl -XDELETE 'localhost:9200/customer?pretty'
curl 'localhost:9200/_cat/indices?v'

然后返回:


curl -XDELETE 'localhost:9200/customer?pretty'
{
  "acknowledged" : true
}
curl 'localhost:9200/_cat/indices?v'
health index pri rep docs.count docs.deleted store.size pri.store.size

这意味着,该索引已成功删除,我们现在又回到我们开始的地方,在我们的集群中什么也没有。

在我们进行下一步之前,让我们再深入的回顾一下我们已经学过的API命令:


curl -XPUT 'localhost:9200/customer'
curl -XPUT 'localhost:9200/customer/external/1' -d '
{
  "name": "John Doe"
}'
curl 'localhost:9200/customer/external/1'
curl -XDELETE 'localhost:9200/customer'

如果我们仔细研究上面的命令,我们可以清楚地看到,如何用Elasticsearch访问数据。该范例可以被概括如下:


curl -X<REST Verb> <Node>:<Port>/<Index>/<Type>/<ID>

所有的API命令中,REST访问模式是很普遍的,如果你可以简单地记住它,你在掌握Elasticsearch上将有一个良好的开端。

results matching ""

    No results matching ""