削除対象のインデックスの内容
curl -H 'Content-Type: application/json' http://localhost:9200/test/_search\?pretty -d '{"query":{"match_all":{}},"size":0}'
{
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 101,
"max_score" : 0.0,
"hits" : [ ]
}
}
データの削除
_delete_by_queryを使ってデータを削除する。
curl -X POST -H 'Content-Type: application/json' http://localhost:9200/test/_delete_by_query?pretty -d '{"query":{"match_all":{}}}'
{
"took" : 106,
"timed_out" : false,
"total" : 101,
"deleted" : 101,
"batches" : 1,
"version_conflicts" : 0,
"noops" : 0,
"retries" : {
"bulk" : 0,
"search" : 0
},
"throttled_millis" : 0,
"requests_per_second" : -1.0,
"throttled_until_millis" : 0,
"failures" : [ ]
}
削除確認
curl -H 'Content-Type: application/json' http://localhost:9200/test/_search\?pretty -d '{"query":{"match_all":{}},"size":0}'
{
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : 0.0,
"hits" : [ ]
}
}