# Should match\_phrase be used in if using match\_phrase\_prefix?

**URL:** https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845
**Category:** Elasticsearch
**Created:** [August 12, 2017, 3:31pm UTC](https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845 "2017-08-12T15:31:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)
#### Post date: [August 12, 2017, 3:31pm UTC](https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845/1 "2017-08-12T15:31:25Z")

</div>

I want to support partial name searches against authors field.  
SO I have something like ...

```auto
                {"match": {"authors": "schm"}},
                {"match_phrase": {"authors": "schm"}},
                {"match_phrase_prefix": {"authors": {
                "query" : "schm",
                "boost":10,
                "max_expansions" : 10
            }}}

```

I had a couple of clarifications to seek ...

1. Do I need both match and match\_phrase? I think yes. If searching for "Chris John", "match\_phrase" wont give back hits for "Chris", and "match" wont give preference to simultaneous occurance of "Chris John".
2. More importantly, if I have match\_phrase\_prefix, do I need "match\_phrase" since match\_phrase\_prefix builds up on original phrase anyway, somewhat like wildcard?

Thanks!

---

<div class="post-metadata">

### Author: ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)
#### Post date: [August 16, 2017, 4:39pm UTC](https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845/2 "2017-08-16T16:39:31Z")

</div>

Anyone any thoughts?

---

<div class="post-metadata">

### Author: ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)
#### Post date: [August 18, 2017, 9:08am UTC](https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845/3 "2017-08-18T09:08:54Z")

</div>

It all depends on the business rules behind your partial name search of course, but:

1. Yes, you are right. If you also want to find documents that contain just parts of the phrase, then you also need to include a `match`
2. I don't think you need the `match_phrase`, as the `match_phrase_prefix` will already score exact matches higher than "wildcard" matches.

---

<div class="post-metadata">

### Author: ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)
#### Post date: [August 24, 2017, 8:31pm UTC](https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845/4 "2017-08-24T20:31:51Z")

</div>

Thank you so much. That helps.

---

<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 21, 2017, 8:31pm UTC](https://discuss.elastic.co/t/should-match-phrase-be-used-in-if-using-match-phrase-prefix/96845/5 "2017-09-21T20:31:52Z")

</div>

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