Full text query using match_phrase_prefix configuration

I have a string "8102 heather street richmond BC V6Y2R1" in one document to search for. I use match_phrase_prefix full text query.

I can find it using the following search strings:
8102 heather str
8102 heather stre
8102 heather stree
8102 heather street

However, I cannot find it using "8102 heather st"?
Looks like it only looks forward for 3 letters?
How to configure so that using "8102 heather st" I can find the address?

Thanks!

No, match_phrase_prefix allows for any letter prefix matches on the last term in the text. "8102 heather st" should match the raw document.

I didn't get.

I cannot use "8102 heather st" to find the address?
OR
I can use "8102 heather st" to find the address but need to do some configuration?

There is no additional configuration need. I tried your sample:

{
  "query": {
    "match_phrase_prefix": {
      "message": "8102 heather st"
    }
  }
}

It works:

{
  "took": 22,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.8630463,
    "hits": [
      {
        "_index": "test3",
        "_type": "doc",
        "_id": "1",
        "_score": 0.8630463,
        "_source": {
          "message": "8102 heather street richmond BC V6Y2R1"
        }
      }
    ]
  }
}

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