Reindexing an index
There are a lot of common scenarios that involve changing a mapping. Due to the limitations of Elasticsearch mapping (it's additive), it not possible to delete a defined one, so you often need to reindex index data in a new index with a new mapping. The most common scenarios are as follows:
- Changing the analyzer of the mapping
- Adding a new subfield to the mapping, where you need to reprocess all the records to search for the new subfield
- Removing unused mappings
- Changing a record structure that requires a new mapping
Getting ready
You will need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands in this recipe, you can use any HTTP client, such as curl (https://curl.haxx.se/), Postman (https://www.getpostman.com/), or others. I suggest using the Kibana console as it provides code completion and better character...