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 care to prevent losing your data.
There are some use cases in which it's required to delete a mapping:
Unused type: You delete it to clean the data.
Wrong mapping: You might need to change the mapping, but you cannot upgrade it or remove some fields. You need to back up your data, create a new mapping, and reimport the data.
Fast cleanup of a type: You can delete the mapping and recreate it (or you can execute a Delete by query, as explained in the Deleting by query recipe in Chapter 5, Search, Queries, and Filters.
Getting ready
You will need a working ElasticSearch cluster and the mapping created in the Putting a mapping in an index recipe in this chapter.
How to do it...
The HTTP method to delete a mapping is DELETE.
The URL formats for getting the mappings are:
http://<server>/<index_name>/<type_name>...