# Adding an integer value with the existing \_id while doing reindex

**URL:** <https://discuss.elastic.co/t/adding-an-integer-value-with-the-existing-id-while-doing-reindex/115086>\
**Category:** Elasticsearch\
**Created:** [January 11, 2018, 12:31pm UTC](https://discuss.elastic.co/t/adding-an-integer-value-with-the-existing-id-while-doing-reindex/115086 "2018-01-11T12:31:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishekh](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@Abhishekh](https://discuss.elastic.co/u/Abhishekh)\
**Post date:** [January 11, 2018, 12:31pm UTC](https://discuss.elastic.co/t/adding-an-integer-value-with-the-existing-id-while-doing-reindex/115086/1 "2018-01-11T12:31:20Z")

</div>

HI,

I would like to reindex with following scenario:  
/source/type/1 to /destination/type/ ((1\<\<56) + \_id). So if the \_id in source index is \_id=10 then at destination index same document should be at 72057594037927940 (calculated by 1\<\<56 = 72057594037927936 + ( source index \_id)) . I tried with  
"script": {  
"source": "ctx.\_id = 'append' + ctx.\_id" } (where append is 1\<\<56 ) but it is concatenating the "72057594037927936" and "10" and creating the document at destination index at id 7205759403792793610. Please help me

---

<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:** [February 8, 2018, 12:31pm UTC](https://discuss.elastic.co/t/adding-an-integer-value-with-the-existing-id-while-doing-reindex/115086/2 "2018-02-08T12:31:28Z")

</div>

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