presto-elasticsearch/src/main/java/io/prestosql/elasticsearch/client/ElasticsearchClient.java/ElasticsearchClient/shardPreference
class ElasticsearchClient:    private int shardPreference(SearchShardsResponse.Shard left, SearchShardsResponse.Shard right)
    {
        // Favor non-primary shards
        if (left.isPrimary() == right.isPrimary()) {
            return 0;
        }

        return left.isPrimary() ? 1 : -1;
    }