App Search - Match first word only

Hi, I'm trying to build an autosuggest with app search but fail to understand how to configure it so it only matches the first word (see screenshot). According to this stack overflow answer this seems doable in elasticsearch by using a keyword tokenizer. But I don't understand how to implement this in app search. I'm using the node app search client and this is my config so far:

const options = {
  search_fields: {
    searchname: {},
  },
  result_fields: {
    name: { raw: {} },
    searchname: { raw: {} },
    alternativename: { raw: {} },
    alternativename2: { raw: {} },
    searchcategory: { raw: {} },
  },
  page: {
    size: 5,
  },
  // how to configure to match only first word of search phrase...
};

Hi @Jonatan ,

It sounds like Suggestions API may be what you're looking for:

Cheers.

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