Autocomplete with filtered data

I have a list of User IDs similar to
let userIds = [ID1, ID2, ID3, ID4…]

Some of the fields within the users documents arefirstName and lastName. I want to first get the ids in the userIds list and then perform a partial text search/autocomplete search on the remaining documents. How do I go about doing that?

The compound operator with the first clause as a filter clause on the userID field. The firstName and lastName can be autocomplete queries in a should clause. Keep in mind, we can filter best

I have the same issue however the search is not giving result.
Question: Do I have to create index for the filter field i.e. userid?


{
“mappings”: {
“dynamic”: false,
“fields”: {
“_id”: {
“type”: “string”
},
“city”: {
“type”: “autocomplete”
},
“contactfirstname”: {
“type”: “autocomplete”
},
“contactlastname”: {
“type”: “autocomplete”
},
“name”: {
“type”: “autocomplete”
}
}
}
}