# Rebuilding replicas

**URL:** <https://discuss.elastic.co/t/rebuilding-replicas/15629>\
**Category:** Elasticsearch\
**Created:** [February 5, 2014, 7:11pm UTC](https://discuss.elastic.co/t/rebuilding-replicas/15629 "2014-02-05T19:11:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asanderson](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@asanderson](https://discuss.elastic.co/u/asanderson)\
**Post date:** [February 5, 2014, 7:11pm UTC](https://discuss.elastic.co/t/rebuilding-replicas/15629/1 "2014-02-05T19:11:07Z")

</div>

Is there a way via API to rebuild a replica other than just restarting the  
replica's node? If not, then I will submit a feature request.

Somehow some of our replicas have different doc totals than their  
primaries, and I don't see a way to fix it via API.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9c64d53c-9fe0-412a-8056-b2d17c3ea59f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9c64d53c-9fe0-412a-8056-b2d17c3ea59f%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Paul\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_smith/32/1323_2.png) [@Paul\_Smith](https://discuss.elastic.co/u/Paul_Smith)\
**Post date:** [February 5, 2014, 7:24pm UTC](https://discuss.elastic.co/t/rebuilding-replicas/15629/2 "2014-02-05T19:24:32Z")

</div>

You can issue a Move allocation command of just the replicas. A single  
move request with each of your replica shards shunted to a different node  
should do it. The move is implemented as a copy from the primary (well it  
is in ES 0.19 anyway)

Note though that if you move things aroun such that a post move  
auto rebalance dictates a shard replica to go back to where it was it  
appears to then find the old copy and just reuse that data which cancels  
out what you just tried to so. 🙂

Paul

On Thursday, 6 February 2014, asanderson [a.steven.anderson@gmail.com](mailto:a.steven.anderson@gmail.com)  
wrote:

> Is there a way via API to rebuild a replica other than just restarting the  
> replica's node? If not, then I will submit a feature request.
> 
> Somehow some of our replicas have different doc totals than their  
> primaries, and I don't see a way to fix it via API.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)\<javascript:\_e(%7B%7D,'cvml','elasticsearch%2Bunsubscribe@googlegroups.com');\>  
> .  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/9c64d53c-9fe0-412a-8056-b2d17c3ea59f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9c64d53c-9fe0-412a-8056-b2d17c3ea59f%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHfYWB4%3DM%2BFyP1GXKNc\_E%3Db4Z08vcOO21p9zcm539KV8L1GnUw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHfYWB4%3DM%2BFyP1GXKNc_E%3Db4Z08vcOO21p9zcm539KV8L1GnUw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![asanderson](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@asanderson](https://discuss.elastic.co/u/asanderson)\
**Post date:** [February 5, 2014, 7:43pm UTC](https://discuss.elastic.co/t/rebuilding-replicas/15629/3 "2014-02-05T19:43:02Z")

</div>

> You can issue a Move allocation command of just the replicas. A single  
> move request with each of your replica shards shunted to a different node  
> should do it. The move is implemented as a copy from the primary (well it  
> is in ES 0.19 anyway)
> 
> Note though that if you move things aroun such that a post move  
> auto rebalance dictates a shard replica to go back to where it was it  
> appears to then find the old copy and just reuse that data which cancels  
> out what you just tried to so. 🙂

Ahhh...so that's the trick. 😉 Well, it definitely wasn't obviously  
reading the API guide. Perhaps there should be a note there. 😉

I actually tried moving the primary which didn't change the replica, but I  
confirmed that moving the replica did rebuild it.

MANY THANKS!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/61b6aafa-3558-4626-b456-4b71d7b13579%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/61b6aafa-3558-4626-b456-4b71d7b13579%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 1:52am UTC](https://discuss.elastic.co/t/rebuilding-replicas/15629/4 "2017-07-06T01:52:19Z")

</div>


