Search-ui suggestions from different engine best practice


I'm using search-ui and I was provided with a list of suggestions I have to add to the autocomplete.

I want to know what's the best way to implement it on the search-ui app.

I have this ideas:

  1. Ingest suggestions in the same engine that documents and set different document_types, then apply global filters to remove suggestions from search results and vice-versa

  2. Create a new engine, then use the onSearch middleware to do a raw call to Appsearch to get the suggestions

  3. Use a meta index to group both docs and suggestions engines, then use the approach #1

I dont like #1 because searches outside search-ui will be mixed.
I dont like #2 because I dont feel good connecting to appsearch outside the original connector
I dont like #3 because I understand meta-engines are supposed to group engines of the same type(?)

I post to hear from you what's the best option, maybe I missed something from the search-ui documentation.


I ended up following #2 , both 1 and 3 means I'm hitting the whole index for suggestions and I dont think is the best.

Added this to my AppSearch config after importing the javascript appsearch connector and created the client.

  onAutocomplete: async ({ searchTerm }) => {
    const opts = {
      search_fields: { suggestion: {} },
      result_fields: { suggestion: { raw: {} } },
    const suggestions = await, opts);
    return {
      autocompletedResults: suggestions.results,

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