Let us say I currently have an index named product
. I want to copy all the documents(data) from this index, along with the mappings/settings. I then want to delete this index product
and restore the data from the backup with a modified mapping/setting. How can this be done. I have looked at elasticdump
. Can I use this? Also do I need to re index the data, if so how do I do that
CodePudding user response:
The Snapshot/Restore API allows you to change index settings (except number_of_shards
), but not mappings (doesn't make sense), when you restore an index.
For instance, the command below restores the product index, but sets the replica count to 0
POST /_snapshot/my_repo/product_snapshot/_restore
{
"indices": "product",
"include_aliases": false,
"index_settings": {
"number_of_replicas": 0
}
}
There's also an option called ignore_index_settings
where you can list index settings to ignore when restoring the index (again except number_of_shards
).
If you want to be able to modify the mappings as well, then you need to use the Reindex API that allows you to physically copy your product index into another index with different settings and mappings.