Elasticsearchでドキュメントを削除する

Elasticsearchでドキュメントを削除する方法を記す。

公式ドキュメント Deleting Documents を参考にした。 www.elastic.co

検証環境: Elasticsearch 6.0.0-rc1

bash-3.2$  curl -XGET 'localhost:9200/customer/doc/2?pretty&pretty'
{
  "_index" : "customer",
  "_type" : "doc",
  "_id" : "2",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "name" : "Jane Doe"
  }
}
bash-3.2$ curl -XDELETE 'localhost:9200/customer/doc/2?pretty&pretty'
{
  "_index" : "customer",
  "_type" : "doc",
  "_id" : "2",
  "_version" : 2,
  "result" : "deleted",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 2,
  "_primary_term" : 1
}
bash-3.2$  curl -XGET 'localhost:9200/customer/doc/2?pretty&pretty'
{
  "_index" : "customer",
  "_type" : "doc",
  "_id" : "2",
  "found" : false
}