Deleting a mapping
The last CRUD (Create, Read, Update, Delete) operation related to mapping is the delete one.
Deleting a mapping is a destructive operation and must be done with caution to prevent losing your data.
Getting ready
You need a working ElasticSearch cluster and the mapping created in the Putting a mapping in an index recipe.
How to do it...
The HTTP method to delete a mapping is DELETE
.
The URL formats for getting the mapping are as follows:
http://<server>/<index_name>/<type_name>
http://<server>/<index_name>/<type_name>/_mapping
For deleting a mapping from in an index, we need to perform the following steps:
If we consider the type order of the previous chapter, the call will be as follows:
curl -XDELETE 'http://localhost:9200/myindex/order/'
If the call is successfully made, the result returned by ElasticSearch should be an HTTP 200 status code and a message similar to the following one:
{"ok":true}
If the mapping/type is missing, the following...