- Elasticsearch 7.0 Cookbook(Fourth Edition)
- Alberto Paro
- 137字
- 2021-06-24 14:52:16
How to do it...
The HTTP method that's that's used to delete an index is DELETE. The following URL contains just the index name:
http://<server>/<index_name>
To delete an index, we will perform the following steps:
- Execute a DELETE call by writing the following command:
DELETE /myindex
- We then check the result returned by Elasticsearch. If everything is all right, it should be as follows:
{
"acknowledged" : true
}
- If the index doesn't exist, a 404 error is returned:
{
"error" : {
"root_cause" : [
{
"type" : "index_not_found_exception",
"reason" : "no such index [myindex]",
"resource.type" : "index_or_alias",
"resource.id" : "myindex",
"index_uuid" : "_na_",
"index" : "myindex"
}
],
"type" : "index_not_found_exception",
"reason" : "no such index [myindex]",
"resource.type" : "index_or_alias",
"resource.id" : "myindex",
"index_uuid" : "_na_",
"index" : "myindex"
},
"status" : 404
}