# Renaming properties during reindex

**URL:** <https://discuss.elastic.co/t/renaming-properties-during-reindex/247926>\
**Category:** Elasticsearch\
**Created:** [September 8, 2020, 8:26pm UTC](https://discuss.elastic.co/t/renaming-properties-during-reindex/247926 "2020-09-08T20:26:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpr](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@dpr](https://discuss.elastic.co/u/dpr)\
**Post date:** [September 8, 2020, 8:26pm UTC](https://discuss.elastic.co/t/renaming-properties-during-reindex/247926/1 "2020-09-08T20:26:30Z")

</div>

Hi!

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!

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 6, 2020, 8:26pm UTC](https://discuss.elastic.co/t/renaming-properties-during-reindex/247926/2 "2020-10-06T20:26:31Z")

</div>

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