Unassigned shards allocation

Hi All,

Please suggest how to resolve the unassigned shards -

curl 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" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 279,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 0.0
}

Regards,
Prateek

Logs?

I had just executed below curl command referring other topics
curl -XPUT http://localhost:9200/_settings -d {"number_of_replicas":1}

Which changed the status from red to yellow-

curl http://localhost:9200/_cluster/health?pretty=true
{
"cluster_name" : "ELASTICSEARCH",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 71,
"active_shards" : 71,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 71,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 50.0
}

Regards,
Prateek

Please suggest how to resolve unassigned shards.

If I change number of replicas to 0 then cluster changes to green status but it goes to yellow as soon as it is changed to 1
curl -XPUT http://localhost:9200/_settings -d {"number_of_replicas":0}

You can't have replicas allocated with only one node.

Thank you David for quick reply.