# Changing number of shards on an index

**URL:** <https://discuss.elastic.co/t/changing-number-of-shards-on-an-index/4565>\
**Category:** Elasticsearch\
**Created:** [June 7, 2011, 8:37am UTC](https://discuss.elastic.co/t/changing-number-of-shards-on-an-index/4565 "2011-06-07T08:37:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [June 7, 2011, 8:37am UTC](https://discuss.elastic.co/t/changing-number-of-shards-on-an-index/4565/1 "2011-06-07T08:37:03Z")

</div>

Hi Shay

In version 0.16.1 it was possible to change the number of shards on an  
index (or at least the new value was stored internally and no  
exception was thrown). With version 0.16.2 I receive the following  
exception during running my Elastica tests:

ElasticSearchIllegalArgumentException[can't change the number of  
shards for an index]

Is that something that shouldn't have been possible in 0.16.1 and is  
now fixed?

Best,  
Nicolas

---

<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:** [June 7, 2011, 11:12am UTC](https://discuss.elastic.co/t/changing-number-of-shards-on-an-index/4565/2 "2011-06-07T11:12:54Z")

</div>

Yep :). The update settings has a controlled list of settings that are allowed to be set. This is better handled in master, but I saw people did it by mistake in 0.16.1, so I added explicit exception for this.

On Tuesday, June 7, 2011 at 11:37 AM, ruflin wrote:

> Hi Shay
> 
> In version 0.16.1 it was possible to change the number of shards on an  
> index (or at least the new value was stored internally and no  
> exception was thrown). With version 0.16.2 I receive the following  
> exception during running my Elastica tests:
> 
> ElasticSearchIllegalArgumentException[can't change the number of  
> shards for an index]
> 
> Is that something that shouldn't have been possible in 0.16.1 and is  
> now fixed?
> 
> Best,  
> Nicolas

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [June 7, 2011, 1:46pm UTC](https://discuss.elastic.co/t/changing-number-of-shards-on-an-index/4565/3 "2011-06-07T13:46:02Z")

</div>

Ok. So the number of shards can always only be set during creating the  
index (which means I should remove the function setNumberOfShards).

On Jun 7, 1:12 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Yep :). The update settings has a controlled list of settings that are allowed to be set. This is better handled in master, but I saw people did it by mistake in 0.16.1, so I added explicit exception for this.
> 
> On Tuesday, June 7, 2011 at 11:37 AM, ruflin wrote:
> 
> > Hi Shay
> 
> > In version 0.16.1 it was possible to change the number of shards on an  
> > index (or at least the new value was stored internally and no  
> > exception was thrown). With version 0.16.2 I receive the following  
> > exception during running my Elastica tests:
> 
> > ElasticSearchIllegalArgumentException[can't change the number of  
> > shards for an index]
> 
> > Is that something that shouldn't have been possible in 0.16.1 and is  
> > now fixed?
> 
> > Best,  
> > Nicolas

---

<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, 4:04am UTC](https://discuss.elastic.co/t/changing-number-of-shards-on-an-index/4565/4 "2017-07-06T04:04:27Z")

</div>


