Is the data in different shared gets varied in search?

In case if i had two documents with same field value across two shared is it differ for same search criteria. For example if i had two msgs

  1. Hi
  2. Hi

If i search

POST /test/test/_search
{
"query": {
"match_phrase_prefix": {
"msg": "hi"
}
}
}

Is there any possibility to get results varied?

Possibly yes, because the score of a document is relative to the other documents in the same shard.

Thanks for your response. Is there any way to avoid it?

Have lots of documents, a single shard, or use routing.