Modify Elasticsearch mappings and settings without downtime
Here is a 3 steps procedure to modify mappings and settings on an existing index without downtime. No need to manually re-import everything.

Step 1: Create a new index
Let’s say the original index name is things
. Create a new index with another name with the new settings and mappings properties:
PUT things2
{
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "text",
"analyzer": "french"
}
}
}
}
}
Step 2: Re-index from old index to new index
Then you need to copy the docs from things
to things2
:
POST _reindex
{
"source": {
"index": "things"
},
"dest": {
"index": "things2"
}
}
Step 3: Create an alias for new index
Finally, you can drop the old index and create an alias for the new one with the same name as the previous one.
POST _aliases
{
"actions" : [
{ "add": { "index": "things2", "alias": "things" } },
{ "remove_index": { "index": "things" } }
]
}
Voilà! You can use things
as usual with the new settings and mappings. 🎉