Primary shard

In the case that the primary itself fails, the node hosting the primary will send a message to the master about it. The indexing operation will wait (up to 1 minute) for the master to promote one of the replicas to be a new primary.

my question:
which in-sysn replica would be promoted to be the new primary shard?
Are there some rules to elect a pramary shard?

No, there's no reliable way to tell which replica will be promoted to primary before it happens.