I am using AWS Cloudsearch and have a field called Auth Level. It has the following values. I mean, each of the following auth_level is for one row.
"auth_level": "[ \"AUTHORISED\" ]",
"auth_level": "[ \"AUTHORIZED\" , \"GOLD\" ]",
"auth_level": "[ \"AUTHORIZED\" , \"PLATINUM\" ]",
"auth_level": "[ \"AUTHORIZED\" , \"SILVER\" ]"
I want to sort the results based on the auth_level value. The sorting logic should be PLATINUM first, followed by GOLD, SILVER, and AUTHORISED. I tried to add the following expression to the expressions section for using it with the sort option.
if(
contains('PLATINUM', auth_level),
4,
if(
contains('GOLD', auth_level),
3,
if(
contains('SILVER', auth_level),
2,
1
)
)
)
So my query will be like q=*&sort=my_rank_expression desc, but I cannot add this as it says invalid configuration. How can I specify these custom sort criteria for AWS Cloud search?