# Copy\_to for the existing data not new coming one

**URL:** <https://discuss.elastic.co/t/copy-to-for-the-existing-data-not-new-coming-one/35649>\
**Category:** Elasticsearch\
**Created:** [November 26, 2015, 9:44am UTC](https://discuss.elastic.co/t/copy-to-for-the-existing-data-not-new-coming-one/35649 "2015-11-26T09:44:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HyukjinKwon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hyukjinkwon/32/5228_2.png) [@HyukjinKwon](https://discuss.elastic.co/u/HyukjinKwon)\
**Post date:** [November 26, 2015, 9:44am UTC](https://discuss.elastic.co/t/copy-to-for-the-existing-data-not-new-coming-one/35649/1 "2015-11-26T09:44:00Z")

</div>

I am pretty new to Elasticsearch.

Now I am trying to upgrade my cluster for the matter of better performance and functionalities, in particular, aggregation pipelining feature.

In order to run a proper aggregation, I would like to use `copy_to` option rather than `script`.  
(My problem is, the data I want to aggregate is in several different fields)

I followed the documentation [here for `copy_to`](https://www.elastic.co/guide/en/elasticsearch/reference/2.x/copy-to.html) and [here for updating `_mapping`](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html).

However, it seems the `copy_to` affects only new data but not for existing one.

I run `curl -XPUT http://localhost:9200/_mapping/type?pretty=true -d '{ "properties" : { "fieldA" : { "type" : "string" , "copy_to": "fieldB" } } }'` and checked the mapping is updated as below.

```json
...
{"properties" : {
          "fieldA" : {
            "type" : "string",
            "copy_to" : "fieldB"
          },
...
},
...

```

Am I missing something?

Is there any clever way to copy data in existing field to another field?

---

<div class="post-metadata">

**Author:** ![HyukjinKwon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hyukjinkwon/32/5228_2.png) [@HyukjinKwon](https://discuss.elastic.co/u/HyukjinKwon)\
**Post date:** [November 27, 2015, 12:46am UTC](https://discuss.elastic.co/t/copy-to-for-the-existing-data-not-new-coming-one/35649/2 "2015-11-27T00:46:16Z")

</div>

I think I have no choice but reindexing [here](https://www.elastic.co/guide/en/elasticsearch/guide/current/reindex.html).

Please share if you have any good idea. Thanks.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 27, 2015, 7:24am UTC](https://discuss.elastic.co/t/copy-to-for-the-existing-data-not-new-coming-one/35649/3 "2015-11-27T07:24:11Z")

</div>

You need to reindex if you want this to change for older data.

---

<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:** [July 5, 2017, 11:35pm UTC](https://discuss.elastic.co/t/copy-to-for-the-existing-data-not-new-coming-one/35649/4 "2017-07-05T23:35:24Z")

</div>


