1. Delete an Index(删除索引)

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.4/_delete_an_index.html

译文链接 : http://www.apache.wiki/pages/viewpage.action?pageId=4260704

贡献者 : 那伊抹微笑ApacheCNApache中文网

现在让我们删除我们刚才创建的索引并且再次列出所有索引 :

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

响应如下 :

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

这意味着索引被成功的删除,并且我们现在又回到了集群中什么都没有的时候了。

在我们继续之前,让我们仔细的看一看一些我们迄今为止学习的 API 命令 :

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

如果我们仔细的研究上面的命令,我们可以清楚的看到,我们如何访问 Elasticsearch 中的数据的 pattern(模式)。该 pattern(模式)可以概括如下 :

<REST Verb> /<Index>/<Type>/<ID>

在所有的 API 命令中这个 REST 访问模式是很常见的,如果您可以简单的记住它,在掌握 Elasticsearch 时您会有一个良好的开端。

Copyright © Kilvn 2021. all right reserved,powered by Gitbook最后更新时间: 2021-06-08 20:22:42

results matching ""

    No results matching ""