# Removing one shard of a pair

**URL:** <https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479>\
**Category:** Elasticsearch\
**Created:** [January 24, 2012, 2:35pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479 "2012-01-24T14:35:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman/32/2224_2.png) [@Kenneth\_Loafman](https://discuss.elastic.co/u/Kenneth_Loafman)\
**Post date:** [January 24, 2012, 2:35pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/1 "2012-01-24T14:35:15Z")

</div>

Hi,

Originally we had the following on a 3-node cluster:

index :  
number\_of\_shards : 2  
number\_of\_replicas : 1

Then we increased the cluster to 4 nodes and modded the setup to:

index :  
number\_of\_shards : 2  
number\_of\_replicas : 1  
auto\_expand\_replicas : "0-all"

The problem is that this increases the number of shards to 8 per index. Is  
there a way to set number\_of\_shards to 1, either automatically, or  
manually? Am I going about this the wrong way if I want a shard on each  
node?

...Thanks,  
...Ken

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 24, 2012, 2:51pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/2 "2012-01-24T14:51:35Z")

</div>

auto\_expand\_replcias is really only meaningful when you have a single shard  
index.

Back to your case, with 2 shards and 1 replica, you have a total of 4  
shards, so on a 4 node cluster, you will have 1 shard per node.

On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman  
[kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)wrote:

> Hi,
> 
> Originally we had the following on a 3-node cluster:
> 
> index :  
> number\_of\_shards : 2  
> number\_of\_replicas : 1
> 
> Then we increased the cluster to 4 nodes and modded the setup to:
> 
> index :  
> number\_of\_shards : 2  
> number\_of\_replicas : 1  
> auto\_expand\_replicas : "0-all"
> 
> The problem is that this increases the number of shards to 8 per index.  
> Is there a way to set number\_of\_shards to 1, either automatically, or  
> manually? Am I going about this the wrong way if I want a shard on each  
> node?
> 
> ...Thanks,  
> ...Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman_2/32/2224_2.png) [@Kenneth\_Loafman\_2](https://discuss.elastic.co/u/Kenneth_Loafman_2)\
**Post date:** [January 24, 2012, 3:19pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/3 "2012-01-24T15:19:00Z")

</div>

So if I remove the auto\_expand\_replicas, it should go back to 4?

On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> auto\_expand\_replcias is really only meaningful when you have a single  
> shard index.
> 
> Back to your case, with 2 shards and 1 replica, you have a total of 4  
> shards, so on a 4 node cluster, you will have 1 shard per node.
> 
> On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> 
> > Hi,
> > 
> > Originally we had the following on a 3-node cluster:
> > 
> > index :  
> > number\_of\_shards : 2  
> > number\_of\_replicas : 1
> > 
> > Then we increased the cluster to 4 nodes and modded the setup to:
> > 
> > index :  
> > number\_of\_shards : 2  
> > number\_of\_replicas : 1  
> > auto\_expand\_replicas : "0-all"
> > 
> > The problem is that this increases the number of shards to 8 per index.  
> > Is there a way to set number\_of\_shards to 1, either automatically, or  
> > manually? Am I going about this the wrong way if I want a shard on each  
> > node?
> > 
> > ...Thanks,  
> > ...Ken

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 24, 2012, 3:26pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/4 "2012-01-24T15:26:24Z")

</div>

Yes, though you can't remove the setting, you can set the auto expand  
setting to false (assuming you work on a live cluster and use the index  
update settings API).

On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:

> So if I remove the auto\_expand\_replicas, it should go back to 4?
> 
> On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > auto\_expand\_replcias is really only meaningful when you have a single  
> > shard index.
> > 
> > Back to your case, with 2 shards and 1 replica, you have a total of 4  
> > shards, so on a 4 node cluster, you will have 1 shard per node.
> > 
> > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > 
> > > Hi,
> > > 
> > > Originally we had the following on a 3-node cluster:
> > > 
> > > index :  
> > > number\_of\_shards : 2  
> > > number\_of\_replicas : 1
> > > 
> > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > 
> > > index :  
> > > number\_of\_shards : 2  
> > > number\_of\_replicas : 1  
> > > auto\_expand\_replicas : "0-all"
> > > 
> > > The problem is that this increases the number of shards to 8 per index.  
> > > Is there a way to set number\_of\_shards to 1, either automatically, or  
> > > manually? Am I going about this the wrong way if I want a shard on each  
> > > node?
> > > 
> > > ...Thanks,  
> > > ...Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman_2/32/2224_2.png) [@Kenneth\_Loafman\_2](https://discuss.elastic.co/u/Kenneth_Loafman_2)\
**Post date:** [January 24, 2012, 3:30pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/5 "2012-01-24T15:30:07Z")

</div>

OK, thanks for the help. I think having one shard and auto-expanding  
replicas is the way to go since we'll be increasing the cluster as we go  
forward.

On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Yes, though you can't remove the setting, you can set the auto expand  
> setting to false (assuming you work on a live cluster and use the index  
> update settings API).
> 
> On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> 
> > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > 
> > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > auto\_expand\_replcias is really only meaningful when you have a single  
> > > shard index.
> > > 
> > > Back to your case, with 2 shards and 1 replica, you have a total of 4  
> > > shards, so on a 4 node cluster, you will have 1 shard per node.
> > > 
> > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Originally we had the following on a 3-node cluster:
> > > > 
> > > > index :  
> > > > number\_of\_shards : 2  
> > > > number\_of\_replicas : 1
> > > > 
> > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > 
> > > > index :  
> > > > number\_of\_shards : 2  
> > > > number\_of\_replicas : 1  
> > > > auto\_expand\_replicas : "0-all"
> > > > 
> > > > The problem is that this increases the number of shards to 8 per index.  
> > > > Is there a way to set number\_of\_shards to 1, either automatically, or  
> > > > manually? Am I going about this the wrong way if I want a shard on each  
> > > > node?
> > > > 
> > > > ...Thanks,  
> > > > ...Ken

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 24, 2012, 3:35pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/6 "2012-01-24T15:35:06Z")

</div>

But then you only expend on replicas, so the index will remain with a  
single shard (partition of the data) size wise. Really depends on what you  
are after...

On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:

> OK, thanks for the help. I think having one shard and auto-expanding  
> replicas is the way to go since we'll be increasing the cluster as we go  
> forward.
> 
> On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Yes, though you can't remove the setting, you can set the auto expand  
> > setting to false (assuming you work on a live cluster and use the index  
> > update settings API).
> > 
> > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > 
> > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > 
> > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > auto\_expand\_replcias is really only meaningful when you have a single  
> > > > shard index.
> > > > 
> > > > Back to your case, with 2 shards and 1 replica, you have a total of 4  
> > > > shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > 
> > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > Originally we had the following on a 3-node cluster:
> > > > > 
> > > > > index :  
> > > > > number\_of\_shards : 2  
> > > > > number\_of\_replicas : 1
> > > > > 
> > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > 
> > > > > index :  
> > > > > number\_of\_shards : 2  
> > > > > number\_of\_replicas : 1  
> > > > > auto\_expand\_replicas : "0-all"
> > > > > 
> > > > > The problem is that this increases the number of shards to 8 per  
> > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > node?
> > > > > 
> > > > > ...Thanks,  
> > > > > ...Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman_2/32/2224_2.png) [@Kenneth\_Loafman\_2](https://discuss.elastic.co/u/Kenneth_Loafman_2)\
**Post date:** [January 24, 2012, 4:05pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/7 "2012-01-24T16:05:07Z")

</div>

Maybe an understanding... From the discussion on the board, I got that a  
replica could be searched the same as a shard, so the idea was that by  
putting one shard/replica per node, there would be no inter-node traffic  
for a search. Is that wrong?

On Tue, Jan 24, 2012 at 9:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> But then you only expend on replicas, so the index will remain with a  
> single shard (partition of the data) size wise. Really depends on what you  
> are after...
> 
> On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> 
> > OK, thanks for the help. I think having one shard and auto-expanding  
> > replicas is the way to go since we'll be increasing the cluster as we go  
> > forward.
> > 
> > On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > Yes, though you can't remove the setting, you can set the auto expand  
> > > setting to false (assuming you work on a live cluster and use the index  
> > > update settings API).
> > > 
> > > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > 
> > > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > > 
> > > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > 
> > > > > auto\_expand\_replcias is really only meaningful when you have a single  
> > > > > shard index.
> > > > > 
> > > > > Back to your case, with 2 shards and 1 replica, you have a total of 4  
> > > > > shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > > 
> > > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > Originally we had the following on a 3-node cluster:
> > > > > > 
> > > > > > index :  
> > > > > > number\_of\_shards : 2  
> > > > > > number\_of\_replicas : 1
> > > > > > 
> > > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > > 
> > > > > > index :  
> > > > > > number\_of\_shards : 2  
> > > > > > number\_of\_replicas : 1  
> > > > > > auto\_expand\_replicas : "0-all"
> > > > > > 
> > > > > > The problem is that this increases the number of shards to 8 per  
> > > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > > node?
> > > > > > 
> > > > > > ...Thanks,  
> > > > > > ...Ken

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 24, 2012, 5:03pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/8 "2012-01-24T17:03:17Z")

</div>

Yes, you do a single shard and have the replicas spread across the  
remaining nodes. But then your index is bounded in size to what a single  
shard can hold. Btw, by default, when you hit a node in the cluster, even  
if a shard exists on it, it might go and execute the request on another  
node (because it can't tell if you are doing loadbalancing across the nodes  
or not). You can configure that by setting the search preference to \_local:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/preference.html).

On Tue, Jan 24, 2012 at 6:05 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:

> Maybe an understanding... From the discussion on the board, I got that a  
> replica could be searched the same as a shard, so the idea was that by  
> putting one shard/replica per node, there would be no inter-node traffic  
> for a search. Is that wrong?
> 
> On Tue, Jan 24, 2012 at 9:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > But then you only expend on replicas, so the index will remain with a  
> > single shard (partition of the data) size wise. Really depends on what you  
> > are after...
> > 
> > On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > 
> > > OK, thanks for the help. I think having one shard and auto-expanding  
> > > replicas is the way to go since we'll be increasing the cluster as we go  
> > > forward.
> > > 
> > > On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > Yes, though you can't remove the setting, you can set the auto expand  
> > > > setting to false (assuming you work on a live cluster and use the index  
> > > > update settings API).
> > > > 
> > > > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > > 
> > > > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > > > 
> > > > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > > 
> > > > > > auto\_expand\_replcias is really only meaningful when you have a single  
> > > > > > shard index.
> > > > > > 
> > > > > > Back to your case, with 2 shards and 1 replica, you have a total of 4  
> > > > > > shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > > > 
> > > > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > Originally we had the following on a 3-node cluster:
> > > > > > > 
> > > > > > > index :  
> > > > > > > number\_of\_shards : 2  
> > > > > > > number\_of\_replicas : 1
> > > > > > > 
> > > > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > > > 
> > > > > > > index :  
> > > > > > > number\_of\_shards : 2  
> > > > > > > number\_of\_replicas : 1  
> > > > > > > auto\_expand\_replicas : "0-all"
> > > > > > > 
> > > > > > > The problem is that this increases the number of shards to 8 per  
> > > > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > > > node?
> > > > > > > 
> > > > > > > ...Thanks,  
> > > > > > > ...Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman_2/32/2224_2.png) [@Kenneth\_Loafman\_2](https://discuss.elastic.co/u/Kenneth_Loafman_2)\
**Post date:** [January 24, 2012, 5:14pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/9 "2012-01-24T17:14:07Z")

</div>

Thanks. One more question, what is the shard size limit?

On Tue, Jan 24, 2012 at 11:03 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Yes, you do a single shard and have the replicas spread across the  
> remaining nodes. But then your index is bounded in size to what a single  
> shard can hold. Btw, by default, when you hit a node in the cluster, even  
> if a shard exists on it, it might go and execute the request on another  
> node (because it can't tell if you are doing loadbalancing across the nodes  
> or not). You can configure that by setting the search preference to \_local:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/preference.html).
> 
> On Tue, Jan 24, 2012 at 6:05 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> 
> > Maybe an understanding... From the discussion on the board, I got that a  
> > replica could be searched the same as a shard, so the idea was that by  
> > putting one shard/replica per node, there would be no inter-node traffic  
> > for a search. Is that wrong?
> > 
> > On Tue, Jan 24, 2012 at 9:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > But then you only expend on replicas, so the index will remain with a  
> > > single shard (partition of the data) size wise. Really depends on what you  
> > > are after...
> > > 
> > > On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > 
> > > > OK, thanks for the help. I think having one shard and auto-expanding  
> > > > replicas is the way to go since we'll be increasing the cluster as we go  
> > > > forward.
> > > > 
> > > > On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > 
> > > > > Yes, though you can't remove the setting, you can set the auto expand  
> > > > > setting to false (assuming you work on a live cluster and use the index  
> > > > > update settings API).
> > > > > 
> > > > > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > > > 
> > > > > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > > > > 
> > > > > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > > > 
> > > > > > > auto\_expand\_replcias is really only meaningful when you have a  
> > > > > > > single shard index.
> > > > > > > 
> > > > > > > Back to your case, with 2 shards and 1 replica, you have a total of  
> > > > > > > 4 shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > > > > 
> > > > > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > Originally we had the following on a 3-node cluster:
> > > > > > > > 
> > > > > > > > index :  
> > > > > > > > number\_of\_shards : 2  
> > > > > > > > number\_of\_replicas : 1
> > > > > > > > 
> > > > > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > > > > 
> > > > > > > > index :  
> > > > > > > > number\_of\_shards : 2  
> > > > > > > > number\_of\_replicas : 1  
> > > > > > > > auto\_expand\_replicas : "0-all"
> > > > > > > > 
> > > > > > > > The problem is that this increases the number of shards to 8 per  
> > > > > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > > > > node?
> > > > > > > > 
> > > > > > > > ...Thanks,  
> > > > > > > > ...Ken

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 24, 2012, 5:34pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/10 "2012-01-24T17:34:24Z")

</div>

There isn't really a limit to a shard size, but, it might exhaust itself in  
several aspects such as search perf, amount of memory used. It really  
depends on what you index and how you search to guess what a good shard  
size is.

On Tue, Jan 24, 2012 at 7:14 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:

> Thanks. One more question, what is the shard size limit?
> 
> On Tue, Jan 24, 2012 at 11:03 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Yes, you do a single shard and have the replicas spread across the  
> > remaining nodes. But then your index is bounded in size to what a single  
> > shard can hold. Btw, by default, when you hit a node in the cluster, even  
> > if a shard exists on it, it might go and execute the request on another  
> > node (because it can't tell if you are doing loadbalancing across the nodes  
> > or not). You can configure that by setting the search preference to \_local:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/preference.html).
> > 
> > On Tue, Jan 24, 2012 at 6:05 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > 
> > > Maybe an understanding... From the discussion on the board, I got that a  
> > > replica could be searched the same as a shard, so the idea was that by  
> > > putting one shard/replica per node, there would be no inter-node traffic  
> > > for a search. Is that wrong?
> > > 
> > > On Tue, Jan 24, 2012 at 9:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > But then you only expend on replicas, so the index will remain with a  
> > > > single shard (partition of the data) size wise. Really depends on what you  
> > > > are after...
> > > > 
> > > > On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > > 
> > > > > OK, thanks for the help. I think having one shard and auto-expanding  
> > > > > replicas is the way to go since we'll be increasing the cluster as we go  
> > > > > forward.
> > > > > 
> > > > > On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > > 
> > > > > > Yes, though you can't remove the setting, you can set the auto expand  
> > > > > > setting to false (assuming you work on a live cluster and use the index  
> > > > > > update settings API).
> > > > > > 
> > > > > > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman \<[kenneth@loafman.com](mailto:kenneth@loafman.com)
> > > > > > 
> > > > > > > wrote:
> > > > > > 
> > > > > > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > > > > > 
> > > > > > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)wrote:
> > > > > > > 
> > > > > > > > auto\_expand\_replcias is really only meaningful when you have a  
> > > > > > > > single shard index.
> > > > > > > > 
> > > > > > > > Back to your case, with 2 shards and 1 replica, you have a total of  
> > > > > > > > 4 shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > > > > > 
> > > > > > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > > > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > Originally we had the following on a 3-node cluster:
> > > > > > > > > 
> > > > > > > > > index :  
> > > > > > > > > number\_of\_shards : 2  
> > > > > > > > > number\_of\_replicas : 1
> > > > > > > > > 
> > > > > > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > > > > > 
> > > > > > > > > index :  
> > > > > > > > > number\_of\_shards : 2  
> > > > > > > > > number\_of\_replicas : 1  
> > > > > > > > > auto\_expand\_replicas : "0-all"
> > > > > > > > > 
> > > > > > > > > The problem is that this increases the number of shards to 8 per  
> > > > > > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > > > > > node?
> > > > > > > > > 
> > > > > > > > > ...Thanks,  
> > > > > > > > > ...Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman_2/32/2224_2.png) [@Kenneth\_Loafman\_2](https://discuss.elastic.co/u/Kenneth_Loafman_2)\
**Post date:** [January 24, 2012, 6:43pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/11 "2012-01-24T18:43:26Z")

</div>

Thanks.

So it's a bit of magic. I was afraid of that.

On Tue, Jan 24, 2012 at 11:34 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> There isn't really a limit to a shard size, but, it might exhaust itself  
> in several aspects such as search perf, amount of memory used. It really  
> depends on what you index and how you search to guess what a good shard  
> size is.
> 
> On Tue, Jan 24, 2012 at 7:14 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> 
> > Thanks. One more question, what is the shard size limit?
> > 
> > On Tue, Jan 24, 2012 at 11:03 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > Yes, you do a single shard and have the replicas spread across the  
> > > remaining nodes. But then your index is bounded in size to what a single  
> > > shard can hold. Btw, by default, when you hit a node in the cluster, even  
> > > if a shard exists on it, it might go and execute the request on another  
> > > node (because it can't tell if you are doing loadbalancing across the nodes  
> > > or not). You can configure that by setting the search preference to \_local:  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/preference.html).
> > > 
> > > On Tue, Jan 24, 2012 at 6:05 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > 
> > > > Maybe an understanding... From the discussion on the board, I got that  
> > > > a replica could be searched the same as a shard, so the idea was that by  
> > > > putting one shard/replica per node, there would be no inter-node traffic  
> > > > for a search. Is that wrong?
> > > > 
> > > > On Tue, Jan 24, 2012 at 9:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > 
> > > > > But then you only expend on replicas, so the index will remain with a  
> > > > > single shard (partition of the data) size wise. Really depends on what you  
> > > > > are after...
> > > > > 
> > > > > On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > > > 
> > > > > > OK, thanks for the help. I think having one shard and auto-expanding  
> > > > > > replicas is the way to go since we'll be increasing the cluster as we go  
> > > > > > forward.
> > > > > > 
> > > > > > On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > > > 
> > > > > > > Yes, though you can't remove the setting, you can set the auto  
> > > > > > > expand setting to false (assuming you work on a live cluster and use the  
> > > > > > > index update settings API).
> > > > > > > 
> > > > > > > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman \<  
> > > > > > > [kenneth@loafman.com](mailto:kenneth@loafman.com)\> wrote:
> > > > > > > 
> > > > > > > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > > > > > > 
> > > > > > > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)wrote:
> > > > > > > > 
> > > > > > > > > auto\_expand\_replcias is really only meaningful when you have a  
> > > > > > > > > single shard index.
> > > > > > > > > 
> > > > > > > > > Back to your case, with 2 shards and 1 replica, you have a total  
> > > > > > > > > of 4 shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > > > > > > 
> > > > > > > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > > > > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > > > > > > 
> > > > > > > > > > Hi,
> > > > > > > > > > 
> > > > > > > > > > Originally we had the following on a 3-node cluster:
> > > > > > > > > > 
> > > > > > > > > > index :  
> > > > > > > > > > number\_of\_shards : 2  
> > > > > > > > > > number\_of\_replicas : 1
> > > > > > > > > > 
> > > > > > > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > > > > > > 
> > > > > > > > > > index :  
> > > > > > > > > > number\_of\_shards : 2  
> > > > > > > > > > number\_of\_replicas : 1  
> > > > > > > > > > auto\_expand\_replicas : "0-all"
> > > > > > > > > > 
> > > > > > > > > > The problem is that this increases the number of shards to 8 per  
> > > > > > > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > > > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > > > > > > node?
> > > > > > > > > > 
> > > > > > > > > > ...Thanks,  
> > > > > > > > > > ...Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Loafman\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman_2/32/2224_2.png) [@Kenneth\_Loafman\_2](https://discuss.elastic.co/u/Kenneth_Loafman_2)\
**Post date:** [January 24, 2012, 7:02pm UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/12 "2012-01-24T19:02:09Z")

</div>

Back to preference, is there an example somewhere on how to use it? I need  
to set it to \_local since pyes does a round-robin load balancing.

On Tue, Jan 24, 2012 at 12:43 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:

> Thanks.
> 
> So it's a bit of magic. I was afraid of that.
> 
> On Tue, Jan 24, 2012 at 11:34 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > There isn't really a limit to a shard size, but, it might exhaust itself  
> > in several aspects such as search perf, amount of memory used. It really  
> > depends on what you index and how you search to guess what a good shard  
> > size is.
> > 
> > On Tue, Jan 24, 2012 at 7:14 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > 
> > > Thanks. One more question, what is the shard size limit?
> > > 
> > > On Tue, Jan 24, 2012 at 11:03 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > Yes, you do a single shard and have the replicas spread across the  
> > > > remaining nodes. But then your index is bounded in size to what a single  
> > > > shard can hold. Btw, by default, when you hit a node in the cluster, even  
> > > > if a shard exists on it, it might go and execute the request on another  
> > > > node (because it can't tell if you are doing loadbalancing across the nodes  
> > > > or not). You can configure that by setting the search preference to \_local:  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/preference.html)  
> > > > .
> > > > 
> > > > On Tue, Jan 24, 2012 at 6:05 PM, Kenneth Loafman [kenneth@loafman.com](mailto:kenneth@loafman.com)wrote:
> > > > 
> > > > > Maybe an understanding... From the discussion on the board, I got that  
> > > > > a replica could be searched the same as a shard, so the idea was that by  
> > > > > putting one shard/replica per node, there would be no inter-node traffic  
> > > > > for a search. Is that wrong?
> > > > > 
> > > > > On Tue, Jan 24, 2012 at 9:35 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > > 
> > > > > > But then you only expend on replicas, so the index will remain with a  
> > > > > > single shard (partition of the data) size wise. Really depends on what you  
> > > > > > are after...
> > > > > > 
> > > > > > On Tue, Jan 24, 2012 at 5:30 PM, Kenneth Loafman \<[kenneth@loafman.com](mailto:kenneth@loafman.com)
> > > > > > 
> > > > > > > wrote:
> > > > > > 
> > > > > > > OK, thanks for the help. I think having one shard and  
> > > > > > > auto-expanding replicas is the way to go since we'll be increasing the  
> > > > > > > cluster as we go forward.
> > > > > > > 
> > > > > > > On Tue, Jan 24, 2012 at 9:26 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)wrote:
> > > > > > > 
> > > > > > > > Yes, though you can't remove the setting, you can set the auto  
> > > > > > > > expand setting to false (assuming you work on a live cluster and use the  
> > > > > > > > index update settings API).
> > > > > > > > 
> > > > > > > > On Tue, Jan 24, 2012 at 5:19 PM, Kenneth Loafman \<  
> > > > > > > > [kenneth@loafman.com](mailto:kenneth@loafman.com)\> wrote:
> > > > > > > > 
> > > > > > > > > So if I remove the auto\_expand\_replicas, it should go back to 4?
> > > > > > > > > 
> > > > > > > > > On Tue, Jan 24, 2012 at 8:51 AM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)wrote:
> > > > > > > > > 
> > > > > > > > > > auto\_expand\_replcias is really only meaningful when you have a  
> > > > > > > > > > single shard index.
> > > > > > > > > > 
> > > > > > > > > > Back to your case, with 2 shards and 1 replica, you have a total  
> > > > > > > > > > of 4 shards, so on a 4 node cluster, you will have 1 shard per node.
> > > > > > > > > > 
> > > > > > > > > > On Tue, Jan 24, 2012 at 4:35 PM, Kenneth Loafman \<  
> > > > > > > > > > [kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > > > > > > > > > 
> > > > > > > > > > > Hi,
> > > > > > > > > > > 
> > > > > > > > > > > Originally we had the following on a 3-node cluster:
> > > > > > > > > > > 
> > > > > > > > > > > index :  
> > > > > > > > > > > number\_of\_shards : 2  
> > > > > > > > > > > number\_of\_replicas : 1
> > > > > > > > > > > 
> > > > > > > > > > > Then we increased the cluster to 4 nodes and modded the setup to:
> > > > > > > > > > > 
> > > > > > > > > > > index :  
> > > > > > > > > > > number\_of\_shards : 2  
> > > > > > > > > > > number\_of\_replicas : 1  
> > > > > > > > > > > auto\_expand\_replicas : "0-all"
> > > > > > > > > > > 
> > > > > > > > > > > The problem is that this increases the number of shards to 8 per  
> > > > > > > > > > > index. Is there a way to set number\_of\_shards to 1, either automatically,  
> > > > > > > > > > > or manually? Am I going about this the wrong way if I want a shard on each  
> > > > > > > > > > > node?
> > > > > > > > > > > 
> > > > > > > > > > > ...Thanks,  
> > > > > > > > > > > ...Ken

---

<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, 3:41am UTC](https://discuss.elastic.co/t/removing-one-shard-of-a-pair/6479/13 "2017-07-06T03:41:38Z")

</div>


