# Full text query using match\_phrase\_prefix configuration

**URL:** <https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430>\
**Category:** Elasticsearch\
**Created:** [August 23, 2019, 3:26am UTC](https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430 "2019-08-23T03:26:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentine-dev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/valentine-dev/32/52868_2.png) [@valentine-dev](https://discuss.elastic.co/u/valentine-dev)\
**Post date:** [August 23, 2019, 3:26am UTC](https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430/1 "2019-08-23T03:26:05Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![wangqinghuan](https://avatars.discourse-cdn.com/v4/letter/w/d26b3c/32.png) [@wangqinghuan](https://discuss.elastic.co/u/wangqinghuan)\
**Post date:** [August 23, 2019, 5:04am UTC](https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430/2 "2019-08-23T05:04:17Z")

</div>

> [@valentine-dev](#):
>
> 8102 heather str

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.

---

<div class="post-metadata">

**Author:** ![valentine-dev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/valentine-dev/32/52868_2.png) [@valentine-dev](https://discuss.elastic.co/u/valentine-dev)\
**Post date:** [August 26, 2019, 5:27pm UTC](https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430/4 "2019-08-26T17:27:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![wangqinghuan](https://avatars.discourse-cdn.com/v4/letter/w/d26b3c/32.png) [@wangqinghuan](https://discuss.elastic.co/u/wangqinghuan)\
**Post date:** [August 27, 2019, 3:25am UTC](https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430/5 "2019-08-27T03:25:33Z")

</div>

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"
        }
      }
    ]
  }
}
```

---

<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 24, 2019, 3:39am UTC](https://discuss.elastic.co/t/full-text-query-using-match-phrase-prefix-configuration/196430/6 "2019-09-24T03:39:59Z")

</div>

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