Renaming properties during reindex


I've been successful at renaming fields during a reindex using a painless script, but I cannot figure out how to rename a (nested) property.

I am trying to rename myObject.oldProperty to myObject.newProperty

Here's what I am trying - hope you can help me out!

POST _reindex
  "source": {
	"index": "logstash-myindex",
	"_source": "myObject"
  "dest": {
	"index": "logstash-myindex-modified"
  "script": {
	"source": "ctx._source.myObject.newPropertyName = ctx._source.myObject.remove(\"oldPropertyName\")"

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