# Reindexing from non-nested to nested

**URL:** <https://discuss.elastic.co/t/reindexing-from-non-nested-to-nested/121547>\
**Category:** Elasticsearch\
**Created:** [February 26, 2018, 6:28pm UTC](https://discuss.elastic.co/t/reindexing-from-non-nested-to-nested/121547 "2018-02-26T18:28:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rishi\_upadhyay](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@rishi\_upadhyay](https://discuss.elastic.co/u/rishi_upadhyay)\
**Post date:** [February 26, 2018, 6:28pm UTC](https://discuss.elastic.co/t/reindexing-from-non-nested-to-nested/121547/1 "2018-02-26T18:28:06Z")

</div>

I created an elastic document with dynamic mapping. As by default elastic does not take the json array as nested but i wanted the mapping to be nested.  
As a solution i had to create a new index with mapping changes to nested and reindex all the data.

I did that but while trying to reindex data elastic is giving illegal argument exception. ( object mapping [performedActions] can't be changed from nested to non-nested)

```
My Earlier Index - `"performedActions" : {
            "properties" : {
              "actionTs" : {
                "type" : "text",
                "fields" : {
                  "keyword" : {
                    "type" : "keyword",
                    "ignore_above" : 256
                  }
                }
              },`

```

New One - `"performedActions" : { "type" : "nested", "properties" : { "actionTs" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } }`

Reindex CURL

```
         curl -XPOST 'localhost:9200/_reindex?pretty' -H 'Content-Type: application/json' -d'
    {
      "source": {
        "index": "pendingonme"
      },
      "dest": {
        "index": "action"
      }
    }
```

---

<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:** [March 26, 2018, 6:28pm UTC](https://discuss.elastic.co/t/reindexing-from-non-nested-to-nested/121547/2 "2018-03-26T18:28:44Z")

</div>

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