1
votes

How to solve unassigned_shards in elasticsearch? When i run command curl -XGET 'localhost:9200/_cluster/health?pretty' i got following result


{
  "cluster_name" : "elasticsearch",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 145,
  "active_shards" : 145,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 145,
  "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
}

1

1 Answers

1
votes

As your cluster only has one node, there will always be unassigned shards - those are replica shards. They are used to restore data when a nodes crashes. They will assign to another node automaticly as soon as your cluster has two nodes. If you dont want to have them, because u are in a local development for example, you can set the replica shard size to 0 in the index mapping. You can look up how to do that here in the Update Indices Settings documentation.