title: Elasticsearch:how to change cluster health from yellow to green
body: <p>I have a cluster with one node (by local). Health cluster is yellow. Now I add more one node, but shards can not be allocated in second node. So the health of my cluster is still yellow. I can not change this state to green, not like as this guide:<a href="http://www.elastic.co/guide/en/elasticsearch/guide/current/_add_an_index.html" rel="noreferrer">health cluster example</a>.</p>
  
  <p>So how to change health state to green?</p>
  
  <p>My cluster:<img src="https://i.stack.imgur.com/6OaW2.png" alt="enter image description here">
  Cluster health:</p>
  
  <pre><code>curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'  
  {
   "cluster_name" : "astrung",
   "status" : "yellow",
   "timed_out" : false,
   "number_of_nodes" : 2,
   "number_of_data_nodes" : 2,
   "active_primary_shards" : 22,
   "active_shards" : 22,
   "relocating_shards" : 0,
   "initializing_shards" : 2,
   "unassigned_shards" : 20
  }
  </code></pre>
  
  <p>Shard status:</p>
  
  <pre><code>curl -XGET 'http://localhost:9200/_cat/shards?v'
   index          shard prirep state        docs  store ip          node 
   _river         0     p      STARTED         2  8.1kb 192.168.1.3 One  
   _river         0     r      UNASSIGNED                                
   megacorp       4     p      STARTED         1  3.4kb 192.168.1.3 One  
   megacorp       4     r      UNASSIGNED                                
   megacorp       0     p      STARTED         2  6.1kb 192.168.1.3 One  
   megacorp       0     r      UNASSIGNED                                
   megacorp       3     p      STARTED         1  2.2kb 192.168.1.3 One  
   megacorp       3     r      UNASSIGNED                                
   megacorp       1     p      STARTED         0   115b 192.168.1.3 One  
   megacorp       1     r      UNASSIGNED                                
   megacorp       2     p      STARTED         1  2.2kb 192.168.1.3 One  
   megacorp       2     r      UNASSIGNED                                
   mybucket       2     p      STARTED         1  2.1kb 192.168.1.3 One  
   mybucket       2     r      UNASSIGNED                                
   mybucket       0     p      STARTED         0   115b 192.168.1.3 One  
   mybucket       0     r      UNASSIGNED                                
   mybucket       3     p      STARTED         2  5.4kb 192.168.1.3 One  
   mybucket       3     r      UNASSIGNED                                
   mybucket       1     p      STARTED         1  2.2kb 192.168.1.3 One  
   mybucket       1     r      UNASSIGNED                                
   mybucket       4     p      STARTED         1  2.5kb 192.168.1.3 One  
   mybucket       4     r      UNASSIGNED                                
   .kibana        0     r      INITIALIZING             192.168.1.3 Two  
   .kibana        0     p      STARTED         2  8.9kb 192.168.1.3 One  
   .marvel-kibana 2     p      STARTED         0   115b 192.168.1.3 One  
   .marvel-kibana 2     r      UNASSIGNED                                
   .marvel-kibana 0     r      INITIALIZING             192.168.1.3 Two  
   .marvel-kibana 0     p      STARTED         1  2.9kb 192.168.1.3 One  
   .marvel-kibana 3     p      STARTED         0   115b 192.168.1.3 One  
   .marvel-kibana 3     r      UNASSIGNED                                
   .marvel-kibana 1     p      STARTED         0   115b 192.168.1.3 One  
   .marvel-kibana 1     r      UNASSIGNED                                
   .marvel-kibana 4     p      STARTED         0   115b 192.168.1.3 One  
   .marvel-kibana 4     r      UNASSIGNED                                
   user_ids       4     p      STARTED        11    5kb 192.168.1.3 One  
   user_ids       4     r      UNASSIGNED                                
   user_ids       0     p      STARTED         7 25.1kb 192.168.1.3 One  
   user_ids       0     r      UNASSIGNED                                
   user_ids       3     p      STARTED        11  4.9kb 192.168.1.3 One  
   user_ids       3     r      UNASSIGNED                                
   user_ids       1     p      STARTED         8 28.7kb 192.168.1.3 One  
   user_ids       1     r      UNASSIGNED                                
   user_ids       2     p      STARTED        11  8.5kb 192.168.1.3 One  
   user_ids       2     r      UNASSIGNED                              
  </code></pre>