# Move all index shards to a node

**URL:** <https://discuss.elastic.co/t/move-all-index-shards-to-a-node/6722>\
**Category:** Elasticsearch\
**Created:** [February 15, 2012, 10:20pm UTC](https://discuss.elastic.co/t/move-all-index-shards-to-a-node/6722 "2012-02-15T22:20:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Urdaneta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jorge_urdaneta/32/2992_2.png) [@Jorge\_Urdaneta](https://discuss.elastic.co/u/Jorge_Urdaneta)\
**Post date:** [February 15, 2012, 10:20pm UTC](https://discuss.elastic.co/t/move-all-index-shards-to-a-node/6722/1 "2012-02-15T22:20:45Z")

</div>

Hi,

We're trying to improve the performance of a Bulk indexing in a  
cluster. The problem here is that dynamic update mapping slows the  
operations when the index grows.

Setting refresh\_interval to -1 doesn't work as still dynamic update  
mapping goes to other cluster nodes.

Setting number\_of\_replicas to 0 doesn't work as still shards get  
distributed accross nodes so dynamic update mapping get slow.

So we wanted to move all shards to one node as we saw that indexing  
those data in a one-node setting is very fast.

We saw here:  
[http://www.elasticsearch.org/guide/reference/modules/cluster.html](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
A setting for creating and index that only goes to a specific node:

curl -XPUT localhost:9200/test -d '{  
"index.routing.allocation.include.tag" : "value1,value2"  
}'

Then it says:

"The provided settings can also be updated in real time using the  
update settings API, allowing to “move” indices (shards) around in  
realtime."

So we try with:

curl -XPUT localhost:9200/TheIndexName/\_settings -d '{  
"index" {  
"number\_of\_replicas" : 0,  
"routing.allocation.include.name" : "TheNodeName"  
}  
}'

We got no replicas (as we requested) but still shards are distributed  
ignoring the setting for routing.allocation.include.name.

We need to do this for only one index. We noticed cluster api also  
allows decomision of specific nodes. But we need other nodes to  
continue working.

Any idea here? a possible bug?

using ElasticSearch 0.18.4 (that feature was introduced in 0.18.0 so  
it should work [https://github.com/elasticsearch/elasticsearch/issues/1311](https://github.com/elasticsearch/elasticsearch/issues/1311))

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [February 16, 2012, 5:40pm UTC](https://discuss.elastic.co/t/move-all-index-shards-to-a-node/6722/2 "2012-02-16T17:40:02Z")

</div>

I am also having issues with bulk indexing to a cluster. The system  
begins to crawl as the index gets larger. And just like you, I set the  
number of replicas to zero and disable the refresh interval. My  
project is still under exploration, so I am only using two nodes.

My question is how were you able to determine that dynamic update  
mappings are the cause of your problems? I have not paid attention to  
the network chatter between the two boxes, but I am wondering if I  
should.

Cheers,

Ivan

On Wed, Feb 15, 2012 at 2:20 PM, Jorge Urdaneta  
[jorge.urdaneta@gmail.com](mailto:jorge.urdaneta@gmail.com) wrote:

> Hi,
> 
> We're trying to improve the performance of a Bulk indexing in a  
> cluster. The problem here is that dynamic update mapping slows the  
> operations when the index grows.
> 
> Setting refresh\_interval to -1 doesn't work as still dynamic update  
> mapping goes to other cluster nodes.
> 
> Setting number\_of\_replicas to 0 doesn't work as still shards get  
> distributed accross nodes so dynamic update mapping get slow.
> 
> So we wanted to move all shards to one node as we saw that indexing  
> those data in a one-node setting is very fast.
> 
> We saw here:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> A setting for creating and index that only goes to a specific node:
> 
> curl -XPUT localhost:9200/test -d '{  
> "index.routing.allocation.include.tag" : "value1,value2"  
> }'
> 
> Then it says:
> 
> "The provided settings can also be updated in real time using the  
> update settings API, allowing to “move” indices (shards) around in  
> realtime."
> 
> So we try with:
> 
> curl -XPUT localhost:9200/TheIndexName/\_settings -d '{  
> "index" {  
> "number\_of\_replicas" : 0,  
> "routing.allocation.include.name" : "TheNodeName"  
> }  
> }'
> 
> We got no replicas (as we requested) but still shards are distributed  
> ignoring the setting for routing.allocation.include.name.
> 
> We need to do this for only one index. We noticed cluster api also  
> allows decomision of specific nodes. But we need other nodes to  
> continue working.
> 
> Any idea here? a possible bug?
> 
> using Elasticsearch 0.18.4 (that feature was introduced in 0.18.0 so  
> it should work [Cluster / Index level allocation filtering · Issue #1311 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1311))

---

<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:** [February 16, 2012, 8:18pm UTC](https://discuss.elastic.co/t/move-all-index-shards-to-a-node/6722/3 "2012-02-16T20:18:53Z")

</div>

First, regarding the allocation, are you trying to filter based on the randomized/explicitly set node name? If so, you should use \_name as the attribute value, not name.

Regarding bulk being slow, how did you came up with the fact that updating the mapping slows it down? Its an async process (updating the mapping). Do you have a case where each new bulk item has new fields?

On Thursday, February 16, 2012 at 12:20 AM, Jorge Urdaneta wrote:

> Hi,
> 
> We're trying to improve the performance of a Bulk indexing in a  
> cluster. The problem here is that dynamic update mapping slows the  
> operations when the index grows.
> 
> Setting refresh\_interval to -1 doesn't work as still dynamic update  
> mapping goes to other cluster nodes.
> 
> Setting number\_of\_replicas to 0 doesn't work as still shards get  
> distributed accross nodes so dynamic update mapping get slow.
> 
> So we wanted to move all shards to one node as we saw that indexing  
> those data in a one-node setting is very fast.
> 
> We saw here:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> A setting for creating and index that only goes to a specific node:
> 
> curl -XPUT localhost:9200/test -d '{  
> "index.routing.allocation.include.tag" : "value1,value2"  
> }'
> 
> Then it says:
> 
> "The provided settings can also be updated in real time using the  
> update settings API, allowing to “move” indices (shards) around in  
> realtime."
> 
> So we try with:
> 
> curl -XPUT localhost:9200/TheIndexName/\_settings -d '{  
> "index" {  
> "number\_of\_replicas" : 0,  
> "routing.allocation.include.name ([http://routing.allocation.include.name](http://routing.allocation.include.name))" : "TheNodeName"  
> }  
> }'
> 
> We got no replicas (as we requested) but still shards are distributed  
> ignoring the setting for routing.allocation.include.name ([http://routing.allocation.include.name](http://routing.allocation.include.name)).
> 
> We need to do this for only one index. We noticed cluster api also  
> allows decomision of specific nodes. But we need other nodes to  
> continue working.
> 
> Any idea here? a possible bug?
> 
> using Elasticsearch 0.18.4 (that feature was introduced in 0.18.0 so  
> it should work [Cluster / Index level allocation filtering · Issue #1311 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1311))

---

<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:39am UTC](https://discuss.elastic.co/t/move-all-index-shards-to-a-node/6722/4 "2017-07-06T03:39:02Z")

</div>


