# Odd behaviour with search\_as\_you\_type

**URL:** <https://discuss.elastic.co/t/odd-behaviour-with-search-as-you-type/267695>\
**Category:** Elasticsearch\
**Created:** [March 18, 2021, 4:00pm UTC](https://discuss.elastic.co/t/odd-behaviour-with-search-as-you-type/267695 "2021-03-18T16:00:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgvarley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mgvarley/32/687_2.png) [@mgvarley](https://discuss.elastic.co/u/mgvarley)\
**Post date:** [March 18, 2021, 4:00pm UTC](https://discuss.elastic.co/t/odd-behaviour-with-search-as-you-type/267695/1 "2021-03-18T16:00:01Z")

</div>

I am using the search\_as\_you\_type field to provide suggestions to users for addresses from a large index of around 30m addresses. I am using this with the default settings for the most part and it generally works great but I have noticed an odd edge case which I cannot work out.

If a customer types "post office" I get suggestions starting with post office, so far so good. However if I then continue with "post office oxford" I have the same suggestions from before (oxford is not being taken into account). If add a comma so "post office oxford," I then get "Post Office, Oxford Road, Stone, Aylesbury HP17 8PB" at the top of the list (great, this is what I was looking for!).

I am baffled as to why it is not until I enter the comma that I get this, I would have expected to start getting suggestions at "post office oxf". Any help would be hugely appreciated as I have been poring over this for hours!

This is my index mapping entry for the description field:

```auto
    "description": {
    	"type": "search_as_you_type",
    	"index_options": "docs",
    	"analyzer": "standard"
    }

```

This is the query:

```auto
    {
       "query": {
          "multi_match": {
             "query": "Post Office Oxford",
             "type": "bool_prefix",
             "fields": [
                "description",
                "description._2gram",
                "description._3gram"
             ]
          }
       }
    }

```

Is there something obvious here that I am doing wrong? Elasticsearch is version 7.7.0.

Thanks in advance for any help or advice!

---

<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:** [April 15, 2021, 4:00pm UTC](https://discuss.elastic.co/t/odd-behaviour-with-search-as-you-type/267695/2 "2021-04-15T16:00:35Z")

</div>

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