Hi,
according to the docs it is possible to change the _id of a document using a script with the reindex API. But if I
POST /_reindex
{
"source": {
"remote": {
"host": "<old-host>:9200"
},
"index": "buildserver",
"type": "build",
"_source": true
},
"dest": {
"index": "buildserver",
"version_type": "internal"
},
"script": {
"lang": "painless",
"inline": "ctx._source._id = ctx._source['Branch'] + '-' + ctx._source['BuildNumber']"
}
}
I get the following error:
{
"index" : "buildserver",
"type" : "build",
"id" : "AViZMdskdMcAfTnlyvdG",
"cause" : {
"type" : "mapper_parsing_exception",
"reason" : "Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."
},
"status" : 400
}
Am I doing anything wrong or is the documentation wrong? Most importantly: Is there a way to change the _id field?
Cheers,
Seb