ElasticSearch sorting by a field from nested fields

Sorting documents by a field inside a nested object in ElasticSearch can sometimes be tricky. Since the same field path can appear…