### Elasticsearch Version

v8.10

RRF produces inconsistent ranking between primary and replica shards when documents from different queries have the same rank.
For example, if: 
doc1 has a rank 1 in the hits set for Query1 (and is not present in the hit set for Query 2)
doc2 has a rank 1 in the hits set for Query2 (and is not present in the hit set for Query 1)

documents doc1 and doc2 could be ranked differently : [doc1, doc2] and [doc2, doc1] depending which shard search will hit.

### Steps to Reproduce

To be provided

### A solution

This happens because for tie breaking, we use internal doc IDs, which is dependant on a shard. Instead we can use an original query ID or order to ensure consistent ordering.

x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRankCoordinatorContext.java
return value;
                });
            }
        }
        
        RRFRankDoc[] sortedResults = results.values().toArray(RRFRankDoc[]::new);
        Arrays.sort(sortedResults, (RRFRankDoc rrf1, RRFRankDoc rrf2) -> {
            if (rrf1.score != rrf2.score) {
                return rrf1.score < rrf2.score ? 1 : -1;
            }
            if (rrf1.shardIndex != rrf2.shardIndex) {
                return rrf1.shardIndex < rrf2.shardIndex ? -1 : 1;
            }
            return rrf1.doc < rrf2.doc ? -1 : 1;
        });
        RRFRankDoc[] topResults = new RRFRankDoc[Math.min(size, sortedResults.length - from)];
        for (int rank = 0; rank < topResults.length; ++rank) {
            topResults[rank] = sortedResults[rank];
            topResults[rank].rank = rank + 1 + from;
        }
        
        
        assert topDocsStats.fetchHits == 0;
        topDocsStats.fetchHits = topResults.length;
        
        
        return new SortedTopDocs(topResults, false, null, null, null, 0);
    }
}