Skip to content

Instantly share code, notes, and snippets.

@ThomasArdal
Created June 16, 2014 06:21
Show Gist options
  • Save ThomasArdal/7f8c77306550948277ec to your computer and use it in GitHub Desktop.
Save ThomasArdal/7f8c77306550948277ec to your computer and use it in GitHub Desktop.
Reindex versioned Elasticsearch index
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))))));
var o = new ReindexObserver<Customer>(onError: e => { });
reindex.Subscribe(o);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment