删除索引

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

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 ""