ES sort in server end when given fileds are equal

random_score for function score query is enough for you? It returns random score based on internal Lucene doc ids as a source of randomness, which is renumbered by merges.

If you want differente results even for repeated same query, maybe you have to use some script field with painless.