How to add filter in "query suggestion" feature

Hi There,

Is that possible to add additional filters in the "query suggestion".
e.g. There is an index:
{
jobID: string,
jobTitle: string,
user: string,
.........
}
We select "jobTitle" this field as a suggestion field. One issue is that if we type words in the search box, then the auto-complete will return all the candidate words for all user.
We would like to an additional filter to narrow down the candidate words belong to specific uers. like user = 'david'

Hi @viphuangwei. I don't believe it's possible to filter on the Query Suggestion endpoint.

However, I think you could implement something similar using the Search endpoint. You could limit Search Field to jobTitle. This would allow you to also apply a Filter on the user field.

{
  "query": "",
  "search_fields": {
    "jobTitle": {}
  },
  "result_fields": {
    "jobTitle": {
      "raw": {}
    }
  },
  "filters": {
    "user": "John"
  }
}

Does that make sense?

That's a work around solution. Thank you.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.