# Re-index with java api (ES 5.1.2)

**URL:** <https://discuss.elastic.co/t/re-index-with-java-api-es-5-1-2/115907>\
**Category:** Elasticsearch\
**Created:** [January 17, 2018, 3:18pm UTC](https://discuss.elastic.co/t/re-index-with-java-api-es-5-1-2/115907 "2018-01-17T15:18:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ariella](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@ariella](https://discuss.elastic.co/u/ariella)\
**Post date:** [January 17, 2018, 3:18pm UTC](https://discuss.elastic.co/t/re-index-with-java-api-es-5-1-2/115907/1 "2018-01-17T15:18:11Z")

</div>

Hi,

I have 2 indices: index\_old and index\_new.  
I want to re-index all the data from index\_old to index\_new, and after that I want to delete index\_old.  
I'm not sure if by the time I get the response from the re-index request, all the data has been re-indexed and I can safely delete index\_old.

the code I'm using is:

`ActionResponse response = ReindexAction.INSTANCE.newRequestBuilder(client).
                source(index_old).destination(index_new).get();`

Can someone help?  
Thanks!

---

<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 14, 2018, 3:18pm UTC](https://discuss.elastic.co/t/re-index-with-java-api-es-5-1-2/115907/2 "2018-02-14T15:18:19Z")

</div>

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