My cluster has a yellow health as it has only one single node, so the replicas remain unasigned simply because no other node is available to contain them.
If you are running Elasticsearch n local just go to another terminal and run elasticsearch again. This way you will have two instance.
You will see following message on the newly run instance:
[Black Widow] detected_master [N'Garai]
On Already running instance(master node)
[N'Garai] added {[Black Widow]
Assuming [N'Garai] and {[Black Widow] to be random node names.