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中文网

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

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

响应如下 :

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

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

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

  1. curl -XPUT 'localhost:9200/customer?pretty'
  2. curl -XPUT 'localhost:9200/customer/external/1?pretty' -d'
  3. {
  4. "name": "John Doe"
  5. }'
  6. curl -XGET 'localhost:9200/customer/external/1?pretty'
  7. curl -XDELETE 'localhost:9200/customer?pretty'

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

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

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