# How to create auto generated ids while reindexing?

**URL:** <https://discuss.elastic.co/t/how-to-create-auto-generated-ids-while-reindexing/188782>\
**Category:** Elasticsearch\
**Created:** [July 3, 2019, 5:13pm UTC](https://discuss.elastic.co/t/how-to-create-auto-generated-ids-while-reindexing/188782 "2019-07-03T17:13:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![SudevPK](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@SudevPK](https://discuss.elastic.co/u/SudevPK)\
**Post date:** [July 4, 2019, 4:43am UTC](https://discuss.elastic.co/t/how-to-create-auto-generated-ids-while-reindexing/188782/3 "2019-07-04T04:43:03Z")

</div>

> [@How to change \_id as GUID during reindex](https://discuss.elastic.co/t/how-to-change-id-as-guid-during-reindex/182552):
>
> I have two different elastic search nodes.I need to reindex 10 indices from one node to 1 index in another node.But there is not unique id's in the 10 indices, so i need to generate \_id as GUID while reindexing

**I am linking my old post of same**  
Try

```
POST _reindex
{
  "source": {
    "index": ["twitter", "twitter2"]
  },
  "dest": {
    "index": "new_twitter"
  },
  "script": {
    "source": "ctx._id=null",
    "lang": "painless"
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/how-to-create-auto-generated-ids-while-reindexing/188782)._
