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命令中是很常见的。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM