Odd behaviour with search_as_you_type

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:

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

This is the query:

    {
       "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!

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