After restarting all the cluster nodes one by one, in the end I still got those 4 unassigned shards.
I followed the instructions in How to resolve the unassigned shards but failed with 400
$ curl -XPOST 'http://127.0.0.1:9200/_cluster/reroute?pretty' -H 'Content-Type: application/json' -d'
> {
> "commands" : [
> {
> "allocate_stale_primary" : {
> "index" : "logstash-2016.08.23",
> "shard" : 4,
> "node" : "my_node_name",
> "accept_data_loss" : true
> }
> }
> ]
> }
> '
{
"error" : {
"root_cause" : [ {
"type" : "illegal_argument_exception",
"reason" : "No allocation command factory registered for name [allocate_stale_primary]"
} ],
"type" : "illegal_argument_exception",
"reason" : "No allocation command factory registered for name [allocate_stale_primary]"
},
"status" : 400
}
I also tried to use the id of the node, not its node name but the result was the same, from
$ curl -s http://localhost:9200/_nodes?pretty
...
"3MItGKMuSXiw1YxVIVwKig" : {
"name" : "my_node_name",
"transport_address" : "IP:9300",
...