Elasticsearch 使用集群 - 删除索引

章节


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

API:

DELETE /customer?pretty
GET /_cat/indices?v

curl命令访问API:

curl -X DELETE "localhost:9200/customer?pretty"
curl -X GET "localhost:9200/_cat/indices?v"

响应:

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size

可以看到,索引被成功删除,现在回到了集群中什么都没有的状态。

在继续之前,让我们再仔细看看,目前学过的一些API命令:

API:

PUT /customer
PUT /customer/_doc/1
{
  "name": "John Doe"
}
GET /customer/_doc/1
DELETE /customer

如果仔细研究上面的命令,可以看出Elasticsearch中访问数据的模式。这种模式可以概括如下:

<HTTP Verb> /<Index>/<Endpoint>/<ID>

这种REST访问模式在API命令中是很常见的。

posted @ 2019-09-05 16:04  吴吃辣  阅读(1201)  评论(0编辑  收藏  举报