# Reindex using NEST v5.4

**URL:** <https://discuss.elastic.co/t/reindex-using-nest-v5-4/94216>\
**Category:** Elasticsearch\
**Created:** [July 22, 2017, 9:14pm UTC](https://discuss.elastic.co/t/reindex-using-nest-v5-4/94216 "2017-07-22T21:14:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![natsudragoneye](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@natsudragoneye](https://discuss.elastic.co/u/natsudragoneye)\
**Post date:** [July 22, 2017, 9:14pm UTC](https://discuss.elastic.co/t/reindex-using-nest-v5-4/94216/1 "2017-07-22T21:14:53Z")

</div>

Hi,

I'm quite new to ElasticSearch. I'm trying to reindex a index in order to rename it. I'm using NEST API v5.4.  
I saw this example:

```
var reindex =
	elasticClient.Reindex<Customer>(r =>
    	r.FromIndex("customers-v1")
        	.ToIndex("customers-v2")
        	.Query(q => q.MatchAll())
        	.Scroll("10s")
        	.CreateIndex(i =>
            	i.AddMapping<Customer>(m =>
                	m.Properties(p =>
                    	p.String(n => n.Name(name => name.Zipcode).Index(FieldIndexOption.not_analyzed))))));

```

**Source:** [http://thomasardal.com/elasticsearch-migrations-with-c-and-nest/](http://thomasardal.com/elasticsearch-migrations-with-c-and-nest/)

However, I can't reproduce this using NEST 5.4. I think that is to version 2.4.  
I check the breaking changes of ElasticSearch and try reindexing using this:  
**Source:** [https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nest-breaking-changes.html](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/nest-breaking-changes.html)

_public method Nest.ReindexDescriptor..ctor Declaration changed (Breaking)_  
_2.x: public .ctor( **IndexName from, IndexName to** ) 5.x: public .ctor()_

```
var reindex = new client.Reindex(oldIndexName, newIndexName);

```

But this did not work to.  
I also search for documentation but i didn't find any code on c#, just JSON  
**Source:** [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html))  
Can someone give me a example how to reindex using NEST 5.4 on C#?

Thanks in advance! 🙂

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [July 28, 2017, 6:28am UTC](https://discuss.elastic.co/t/reindex-using-nest-v5-4/94216/2 "2017-07-28T06:28:36Z")

</div>

You can use the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) within NEST to reindex data from one index to another

```
var reindexResponse = client.ReindexOnServer(r => r
    .Source(s => s
        .Index("old-index")
    )
    .Destination(d => d
        .Index("new-index")
    )
    .WaitForCompletion(true)
);
```

---

<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:** [August 25, 2017, 6:28am UTC](https://discuss.elastic.co/t/reindex-using-nest-v5-4/94216/3 "2017-08-25T06:28:36Z")

</div>

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