When will Master Node push replica to new join data node?

Hi I'd like to know the whole process of primary shard & replica shard actual interaction process.
I have a single node and setting with 2 shards & 1 replica. When I start to index document,

  1. since there is only one node (it is mater node), where does replica shard exist?

  2. if a new node join as data node, does master node knows and when push shard to new node as replica?

I trace the source code (1.7.2) and I can see primaryPhase and replicaPhase. but if I have only one node, seems nothing happended on replica.

since there is only one node (it is mater node), where does replica shard exist?

Nowhere. ES refuses to allocate a replica shard on the same node as the primary shard. It's therefore useful to try to have replicas in a single-node cluster.

@magnusbaeck thank.
But what if later I setup a new node to join?
Will master start to replicate data to new node(with all indexed docs before new node join) or stat to allocate replica from new node join?

Replica shards will always be in sync with the primary shards.

When the new node joins ES will try and allocate unallocated shard copies
to it. That means if you have a single node cluster and you make an index
with number_of_replicas: 1 and you add another node, then that other node
will get a second copy of everything on the first node.