# Where the source code that locate the shard data from primary to replica

**URL:** <https://discuss.elastic.co/t/where-the-source-code-that-locate-the-shard-data-from-primary-to-replica/41026>\
**Category:** Elasticsearch\
**Created:** [February 5, 2016, 7:26am UTC](https://discuss.elastic.co/t/where-the-source-code-that-locate-the-shard-data-from-primary-to-replica/41026 "2016-02-05T07:26:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kewn21](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@kewn21](https://discuss.elastic.co/u/kewn21)\
**Post date:** [February 5, 2016, 7:26am UTC](https://discuss.elastic.co/t/where-the-source-code-that-locate-the-shard-data-from-primary-to-replica/41026/1 "2016-02-05T07:26:33Z")

</div>

After change the dynamic index setting which is number\_of\_replicas,ShardsAllocators would rebalance shard by BalancedShardsAllocator's Balancer,but i can't find which code to send the primary shard data to replica node.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [February 6, 2016, 3:45pm UTC](https://discuss.elastic.co/t/where-the-source-code-that-locate-the-shard-data-from-primary-to-replica/41026/2 "2016-02-06T15:45:49Z")

</div>

Take a look at `org.elasticsearch.indices.recovery.RecoverySource`.

---

<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 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/where-the-source-code-that-locate-the-shard-data-from-primary-to-replica/41026/3 "2017-07-05T23:18:25Z")

</div>

Closed on July 5, 2017, 11:18pm UTC


