Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce number of shards in ElasticSearch

Is it possible to reduce the number of shards in ElasticSearch search engine once the index is created ?

I tried :

$ curl -XPUT 'localhost:9200/myindex/_settings' -d '{"index" : {"number_of_shards" : 3}}'

But it gives an error :

{"error":"ElasticsearchIllegalArgumentException[can't change the number of shards for an index]","status":400}
like image 982
Fedir RYKHTIK Avatar asked Apr 30 '15 08:04

Fedir RYKHTIK


Video Answer


2 Answers

This is no longer true, with 5.x you can shring the number of indexes to a whole fraction. For example from 12 you could go down to 1, 2, 3 or 6 (see the docs). But you must put it to read-only mode and naturally the shrinking process requires lots of IO.

like image 145
NikoNyrh Avatar answered Oct 19 '22 14:10

NikoNyrh


No, it's not possible. You could change a lot of stuff - e.g. number of replicas for each shard, or many other index settings, but not the number of shards.

For more information - take a look here - http://www.elastic.co/guide/en/elasticsearch/reference/1.5/indices-update-settings.html

like image 24
Mysterion Avatar answered Oct 19 '22 14:10

Mysterion