Changing mapping during the restore

Hello i would like to retore the my index asset_item_index_1 to another another index asset_pp_item_index_1

index save with mapping

{
"asset_item_index_1": {
"aliases": {
"asset_pp_item": {
"is_write_index": true
}
},
"mappings": {
"asset_item": {
"dynamic": "false",
"properties": {
"companyId": {
"type": "long"
},
"id": {
"type": "long"
},
"interventionLink": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"inventoryNumber": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "lower_analyzer",
"fielddata": true
},
"quantity": {
"type": "long"
},
"reloadFluidDate": {
"type": "date"
},
"userId": {
"type": "long"
},
"withdrawFluidDate": {
"type": "date"
}
}
}
},
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "asset_item_index_1",
"creation_date": "1564995341727",
"analysis": {
"analyzer": {
"lower_analyzer": {
"filter": [
"lowercase"
],
"tokenizer": "keyword"
}
}
},
"number_of_replicas": "1",
"uuid": "7E7Cv9G5TSqlp7Z_sAZmBw",
"version": {
"created": "6040299"
}
}
}
}
}

index retore with mapping

{
"asset_pp_item_index_1": {
"aliases": {
"asset_pp_item": {
"is_write_index": true
}
},
"mappings": {
"asset_item": {
"dynamic": "false",
"properties": {
"companyId": {
"type": "long"
},
"id": {
"type": "long"
},
"interventionLink": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"inventoryNumber": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "lower_analyzer",
"fielddata": true
},
"quantity": {
"type": "long"
},
"reloadFluidDate": {
"type": "date"
},
"userId": {
"type": "long"
},
"withdrawFluidDate": {
"type": "date"
}
}
}
},
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "asset_item_index_1",
"creation_date": "1564995341727",
"analysis": {
"analyzer": {
"lower_analyzer": {
"filter": [
"lowercase"
],
"tokenizer": "keyword"
}
}
},
"number_of_replicas": "1",
"uuid": "7E7Cv9G5TSqlp7Z_sAZmBw",
"version": {
"created": "6040299"
}
}
}
}
}

but the type asset_item were never changes, i don't know why ?

below my query restore
POST /_snapshot/my_backup/snapshot_1/_restore
{
"indices": "asset_item_index_1",
"rename_pattern": "asset_item_index_1",
"include_aliases": true,
"rename_replacement": "asset_pp_item_index_1"
}
have you some idea or what do can i do it ?

You can not restore to an index with a different mapping as the mapping is part of the snapshot. Changing mappings require reindexing.

Thank you Christian, it is almost the same mapping except "provided_name": " asset_item_index_1 " and type " asset_item_index_1 " that i want to change respectively "provided_name": " asset_pp_item_index_1 " and type "provided_name": " asset_pp_tem_index_1 "

So the great solution is to reindex after restore

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.