# App Search - Match first word only

**URL:** https://discuss.elastic.co/t/app-search-match-first-word-only/282751
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [August 29, 2021, 11:06am UTC](https://discuss.elastic.co/t/app-search-match-first-word-only/282751 "2021-08-29T11:06:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jonatan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonatan/32/83834_2.png) [@Jonatan](https://discuss.elastic.co/u/Jonatan)
#### Post date: [August 29, 2021, 11:06am UTC](https://discuss.elastic.co/t/app-search-match-first-word-only/282751/1 "2021-08-29T11:06:29Z")

</div>

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](https://stackoverflow.com/questions/29741641/elasticsearch-starts-with-first-word-in-phrases). 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:

```auto
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...
};

```

 ![Screenshot_2021-07-24_at_10.24.38](https://us1.discourse-cdn.com/elastic/original/3X/6/1/616a1ef1ef4e8866fbc89a726fd0620afe4f54d0.png)

---

<div class="post-metadata">

### Author: ![Irina\_Truong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/irina_truong/32/112040_2.png) [@Irina\_Truong](https://discuss.elastic.co/u/Irina_Truong)
#### Post date: [September 2, 2021, 11:43pm UTC](https://discuss.elastic.co/t/app-search-match-first-word-only/282751/2 "2021-09-02T23:43:30Z")

</div>

Hi @Jonatan ,

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

> **[Query Suggestions Guide | Elastic App Search Documentation \[7.14\] | Elastic](https://www.elastic.co/guide/en/app-search/current/query-suggestions-guide.html)**

Cheers.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 30, 2021, 11:44pm UTC](https://discuss.elastic.co/t/app-search-match-first-word-only/282751/3 "2021-09-30T23:44:28Z")

</div>

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