# Assigning, or just Deleting shards

**URL:** <https://discuss.elastic.co/t/assigning-or-just-deleting-shards/22951>\
**Category:** Elasticsearch\
**Created:** [March 27, 2015, 7:15pm UTC](https://discuss.elastic.co/t/assigning-or-just-deleting-shards/22951 "2015-03-27T19:15:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asrozar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asrozar/32/675_2.png) [@asrozar](https://discuss.elastic.co/u/asrozar)\
**Post date:** [March 27, 2015, 7:15pm UTC](https://discuss.elastic.co/t/assigning-or-just-deleting-shards/22951/1 "2015-03-27T19:15:38Z")

</div>

I have an elasticsearch host (single) that has a few hundred unassigned  
shards.

curl -XGET '[http://localhost:9200/\_cluster/health?pretty=true](http://localhost:9200/_cluster/health?pretty=true)'  
{  
"cluster\_name" : "elasticsearch",  
"status" : "red",  
"timed\_out" : false,  
"number\_of\_nodes" : 1,  
"number\_of\_data\_nodes" : 1,  
"active\_primary\_shards" : 291,  
"active\_shards" : 291,  
"relocating\_shards" : 0,  
"initializing\_shards" : 0,  
"unassigned\_shards" : 429,  
"number\_of\_pending\_tasks" : 0  
}

I'd love to fix this, I've tried to re-route them with this;

curl -XPOST 'localhost:9200/\_cluster/reroute' -d '{"commands": [  
{"allocate": {  
"index": "logstash-2015.02.17",  
"shard": 4,  
"node": "FSLSO-LOGSERVER",  
"allow\_primary": true }  
}]  
}'

I get the error, "Is not allowed, reason: [NO(shard cannot be allocated on  
same node [cGB66XJqTbeo9zstZTE2Eg] it already exists on".

Is there a way around this?

Is there a way to just delete the unassigned shards?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7e7f6173-1606-48f6-be11-865c50525284%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7e7f6173-1606-48f6-be11-865c50525284%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![aaronmefford](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaronmefford/32/460_2.png) [@aaronmefford](https://discuss.elastic.co/u/aaronmefford)\
**Post date:** [March 30, 2015, 11:48pm UTC](https://discuss.elastic.co/t/assigning-or-just-deleting-shards/22951/2 "2015-03-30T23:48:34Z")

</div>

In a single node cluster set the replica count to 0. The shards will clean  
themselves up automatically. Don't forget to do regular backups as you  
have no redundancy.

On Friday, March 27, 2015 at 1:15:38 PM UTC-6, [avery...@insecure-it.com](mailto:avery...@insecure-it.com)  
wrote:

> I have an elasticsearch host (single) that has a few hundred unassigned  
> shards.
> 
> curl -XGET '[http://localhost:9200/\_cluster/health?pretty=true](http://localhost:9200/_cluster/health?pretty=true)'  
> {  
> "cluster\_name" : "elasticsearch",  
> "status" : "red",  
> "timed\_out" : false,  
> "number\_of\_nodes" : 1,  
> "number\_of\_data\_nodes" : 1,  
> "active\_primary\_shards" : 291,  
> "active\_shards" : 291,  
> "relocating\_shards" : 0,  
> "initializing\_shards" : 0,  
> "unassigned\_shards" : 429,  
> "number\_of\_pending\_tasks" : 0  
> }
> 
> I'd love to fix this, I've tried to re-route them with this;
> 
> curl -XPOST 'localhost:9200/\_cluster/reroute' -d '{"commands": [  
> {"allocate": {  
> "index": "logstash-2015.02.17",  
> "shard": 4,  
> "node": "FSLSO-LOGSERVER",  
> "allow\_primary": true }  
> }]  
> }'
> 
> I get the error, "Is not allowed, reason: [NO(shard cannot be allocated  
> on same node [cGB66XJqTbeo9zstZTE2Eg] it already exists on".
> 
> Is there a way around this?
> 
> Is there a way to just delete the unassigned shards?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b9247b4d-bfe2-499d-9881-e299286547b2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b9247b4d-bfe2-499d-9881-e299286547b2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 31, 2015, 1:46am UTC](https://discuss.elastic.co/t/assigning-or-just-deleting-shards/22951/3 "2015-03-31T01:46:46Z")

</div>

To elaborate, you cannot assign replicas in a single node cluster, it makes  
no sense to assign these to the same node as you get no redundancy.  
Which is why ES will not allow you to force assign them.

On 31 March 2015 at 10:48, Aaron Mefford [aaron@mefford.org](mailto:aaron@mefford.org) wrote:

> In a single node cluster set the replica count to 0. The shards will  
> clean themselves up automatically. Don't forget to do regular backups as  
> you have no redundancy.
> 
> On Friday, March 27, 2015 at 1:15:38 PM UTC-6, [avery...@insecure-it.com](mailto:avery...@insecure-it.com)  
> wrote:
> 
> > I have an elasticsearch host (single) that has a few hundred unassigned  
> > shards.
> > 
> > curl -XGET '[http://localhost:9200/\_cluster/health?pretty=true](http://localhost:9200/_cluster/health?pretty=true)'  
> > {  
> > "cluster\_name" : "elasticsearch",  
> > "status" : "red",  
> > "timed\_out" : false,  
> > "number\_of\_nodes" : 1,  
> > "number\_of\_data\_nodes" : 1,  
> > "active\_primary\_shards" : 291,  
> > "active\_shards" : 291,  
> > "relocating\_shards" : 0,  
> > "initializing\_shards" : 0,  
> > "unassigned\_shards" : 429,  
> > "number\_of\_pending\_tasks" : 0  
> > }
> > 
> > I'd love to fix this, I've tried to re-route them with this;
> > 
> > curl -XPOST 'localhost:9200/\_cluster/reroute' -d '{"commands": [  
> > {"allocate": {  
> > "index": "logstash-2015.02.17",  
> > "shard": 4,  
> > "node": "FSLSO-LOGSERVER",  
> > "allow\_primary": true }  
> > }]  
> > }'
> > 
> > I get the error, "Is not allowed, reason: [NO(shard cannot be allocated  
> > on same node [cGB66XJqTbeo9zstZTE2Eg] it already exists on".
> > 
> > Is there a way around this?
> > 
> > Is there a way to just delete the unassigned shards?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/b9247b4d-bfe2-499d-9881-e299286547b2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b9247b4d-bfe2-499d-9881-e299286547b2%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/b9247b4d-bfe2-499d-9881-e299286547b2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b9247b4d-bfe2-499d-9881-e299286547b2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-sSDLg-ki%2BYL\_Txi69vBuyq\_a65N8aP1o%3DhzWZ61dJKA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-sSDLg-ki%2BYL_Txi69vBuyq_a65N8aP1o%3DhzWZ61dJKA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:22am UTC](https://discuss.elastic.co/t/assigning-or-just-deleting-shards/22951/4 "2017-07-06T00:22:58Z")

</div>


