Hello,
I'm working on an autocomplete input similar to what twitter uses.
I need to have the matching users I follow at the top of the list (see yellow highlight on the screenshot)

For now I have a query like this :
{
"suggest": {
"suggestions": {
"prefix": "dan",
"completion": {
"field": "suggest_users",
"fuzzy": {
"fuzziness": "AUTO",
"prefix_length": 3
}
}
}
}
}
But I'd like to enhance it with a script_score like this (pseudo code):
{
"script_score" : {
"query" : { ??? },
"script" : {
"params": {
"following_user_ids": [...]
},
"source" : "... params.following_user_ids.contains(doc['user_id'].value) ..."
}
}
}
But each time I try to merge these 2 pieces of code I get an error.
Is it possible to use script_score with suggests ?
If not what would be a smart workaround ?
Thanks 