Elastic Search - Node failures

As I understand from the documentation, when a node goes down, elastic search automatically creates primary or replica shards on all other nodes to address the failure of the node.

However, what happens if the nodes comes up - will those shards are "automatically" removed created on other node as the machine comes up - say , in a cluster with 3 nodes , node 1 which contains 1 primary shard of index 1 , and one replica shard of index 2 . If node 1 goes down, the ES automatically creates the primary shard , replica shard in either of the available nodes

This section is quite old but as far as I can tell still valid, and this blog post may also be quite useful.