I'm using the following to sort documents in Elasticsearch that have a 'usernamesAssigned' property. usernamesAssigned is an array of strings:
"sort": [
{
"_script": {
"script": "doc["usernamesAssigned"].values.sort().join()",
"type": "string",
"lang": "js",
"order": "asc"
}
}
]
I'm wondering if there's a more efficient way to do this without using script based sorting?