# Rebalance the data within the shards?

**URL:** <https://discuss.elastic.co/t/rebalance-the-data-within-the-shards/130567>\
**Category:** Elasticsearch\
**Created:** [May 4, 2018, 6:21am UTC](https://discuss.elastic.co/t/rebalance-the-data-within-the-shards/130567 "2018-05-04T06:21:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stzx](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Stzx](https://discuss.elastic.co/u/Stzx)\
**Post date:** [May 4, 2018, 6:21am UTC](https://discuss.elastic.co/t/rebalance-the-data-within-the-shards/130567/1 "2018-05-04T06:21:41Z")

</div>

Is there a way to rebalance the data within the shards?

Just like:

> Source:

| shard | total |
| --- | --- |
| 0 | 45488 |
| 1 | 0 |
| 2 | 512 |
| 3 | 0 |
| 4 | 4000 |

> Target:

| shard | total |
| --- | --- |
| 0 | 10000 |
| 1 | 10000 |
| 2 | 10000 |
| 3 | 10000 |
| 4 | 10000 |

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 4, 2018, 6:26am UTC](https://discuss.elastic.co/t/rebalance-the-data-within-the-shards/130567/2 "2018-05-04T06:26:21Z")

</div>

Why do you have such an uneven distribution in the first place? Are you using routing, nested documents and/or parent-child?

---

<div class="post-metadata">

**Author:** ![Stzx](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Stzx](https://discuss.elastic.co/u/Stzx)\
**Post date:** [May 4, 2018, 7:09am UTC](https://discuss.elastic.co/t/rebalance-the-data-within-the-shards/130567/3 "2018-05-04T07:09:30Z")

</div>

Thank you for your reminding.

I realized that I had set up routing that caused the data to be migrated to specific shard when stored.

XD

---

<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:** [June 1, 2018, 7:09am UTC](https://discuss.elastic.co/t/rebalance-the-data-within-the-shards/130567/4 "2018-06-01T07:09:31Z")

</div>

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