How to change a documents _id during a reindex

The _id does not belong within the _source. Please see my example below:

  "script": {
    "inline": "ctx._id= ctx._source['Branch'] + '-' + ctx._source['BuildNumber']",
    "lang": "painless"
  }
3 Likes