How to re-create doc id (_id) during remote reindex?

I am doing remote reindex from ES 1.4.4 to ES 5.1.1 for data migration, the doc id in source index is created manually and I need to re-create it in destination index (either auto generated by destination ES server or uuid by the painless script) on destination server.
I tried as followings, but none of them is working, How can I replace the doc id (_id) during the reindex?

Thanks lot for help!

"source": {
"remote": {
"host": "source hostname :9200"
"index": "srcindex",
"size": 200
"dest": {
"index": "desindex",
"type": "mytype"
"script": {
"inline": "ctx._id=UUID.fromString("????xxxxxx")", // use the script to gen uuid

"inline": "ctx._id.delete()", // delete it and let ES auto gen it

"lang": "painless"


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