Error on creating replicas

When I change the number of replicas of a particular index from 1 to 2, the data stops entering the elasticsearch. The document count becomes static and does not change. Moreover, all the replicated shards are unassigned. Kindly help. Please.

How many nodes do you have in your cluster?

Right now I have only one. Kindly explain me how adding more nodes will affect this?

I have one node, status is green with 0 replicas, and data enters elasticsearch.
status is yellow with 1 replica, but still data enters.
status is yellow with >1 replicas, but data does not enter the elasticsearch.

Elasticsearch will never allocate replicas to the same node as the primary, so if you only have one node in your cluster you should set the number of replicas to 0. When writing to an index, a quorum of shards (primary and replica) must be available in order for the write to succeed. If you have 1 replica, quorum is assumed to be 1, meaning that your single primary shard is able to accept writes. When you set the number of replicas to 2, a quorum of 2 shards that to be available, which can never be the case on a single node cluster, which is why all writes fail.