Search code examples
elasticsearchelasticsearch-painless

Does modifying a value in Reindexing context w/ painless update both source and destination documents, or just destination?


If I ran this command would it also modify the routing value of the document in the source index, or just in the destination index? Thanks.

POST _reindex
{
  "source": {
    "index": "{old_index_name}",
    "size": {batch_size}
  },
  "dest": {
    "index": "{new_index_name}"
  },
  "script": {
    "lang": "painless",
    "inline": "ctx._routing=ctx._source.field1"
  }
}

Solution

  • Only the destination document will be modified.

    The one in the source index will stay untouched.