# MultiMatch with phrase\_prefix support for boost?

**URL:** <https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873>\
**Category:** Elasticsearch\
**Created:** [April 8, 2014, 12:11pm UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873 "2014-04-08T12:11:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 8, 2014, 12:11pm UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/1 "2014-04-08T12:11:46Z")

</div>

Hi,

I have a query as below :

"multi\_match" : {  
"query" : "_happy_",  
"fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
"type": "_phrase\_prefix_",  
"operator" : "AND"  
}

Result return in the following order:  
1)  
"\_score": 2.1704028,  
"\_source": {  
"DISPLAY\_NAME": "_Happy_man",

1. 

"\_score": 1.4312989,  
"\_source": {  
"DISPLAY\_NAME": "Boishakh (Version 1)",  
"PERFORMER": "_Happy_",

1. 

"\_score": 1.2510761,  
"\_source": {  
"DISPLAY\_NAME": "Franzl Im Happysound",  
"PERFORMER": "Franzl & Die Psayrer",

1. "\_score": 1.0920545,  
"\_source": {  
"DISPLAY\_NAME": "_Happy_",  
"PERFORMER": "Diandra Arjunaidi"

As the result shown why the #4 have lesser score computed as i already  
added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not working  
for multimatch phrase query ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/05f7f87d-bef4-44b3-9b28-8806e0240e08%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05f7f87d-bef4-44b3-9b28-8806e0240e08%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [April 8, 2014, 12:44pm UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/2 "2014-04-08T12:44:47Z")

</div>

Turn on the explain feature to see why example 4 is not getting a higher  
score.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

I suspect it has something to do with the way you are indexing your data.  
If you still have issues a gist would help us.

Dan

On Tuesday, April 8, 2014 1:11:46 PM UTC+1, cyrilforce wrote:

> Hi,
> 
> I have a query as below :
> 
> "multi\_match" : {  
> "query" : "_happy_",  
> "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> "type": "_phrase\_prefix_",  
> "operator" : "AND"  
> }
> 
> Result return in the following order:  
> 1)  
> "\_score": 2.1704028,  
> "\_source": {  
> "DISPLAY\_NAME": "_Happy_man",
> 
> 1. 
> 
> "\_score": 1.4312989,  
> "\_source": {  
> "DISPLAY\_NAME": "Boishakh (Version 1)",  
> "PERFORMER": "_Happy_",
> 
> 1. 
> 
> "\_score": 1.2510761,  
> "\_source": {  
> "DISPLAY\_NAME": "Franzl Im Happysound",  
> "PERFORMER": "Franzl & Die Psayrer",
> 
> 1. "\_score": 1.0920545,  
> "\_source": {  
> "DISPLAY\_NAME": "_Happy_",  
> "PERFORMER": "Diandra Arjunaidi"
> 
> As the result shown why the #4 have lesser score computed as i already  
> added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not working  
> for multimatch phrase query ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 8, 2014, 4:15pm UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/3 "2014-04-08T16:15:38Z")

</div>

Hi Dan,

I have enabled an analyzer in mapping due to stopword :

"_DISPLAY\_NAME_": {  
"type": "string",  
"_analyzer_": "_standard_"  
}

\*The query : \*

"multi\_match" : {  
"query" : "_happy_",  
"fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
"type": "_phrase\_prefix_",  
"operator" : "AND"  
}

_The result returned with explain enabled :_  
_[multimatch\_with\_phrase\_prefix · GitHub](https://gist.github.com/cheehoo/10149517)  
 [https://gist.github.com/cheehoo/10149517](https://gist.github.com/cheehoo/10149517)_

Thanks

On Tue, Apr 8, 2014 at 8:44 PM, Dan [dan.tuffery@gmail.com](mailto:dan.tuffery@gmail.com) wrote:

> Turn on the explain feature to see why example 4 is not getting a higher  
> score.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-explain.html)
> 
> I suspect it has something to do with the way you are indexing your data.  
> If you still have issues a gist would help us.
> 
> Dan
> 
> On Tuesday, April 8, 2014 1:11:46 PM UTC+1, cyrilforce wrote:
> 
> > Hi,
> > 
> > I have a query as below :
> > 
> > "multi\_match" : {  
> > "query" : "_happy_",  
> > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > "type": "_phrase\_prefix_",  
> > "operator" : "AND"  
> > }
> > 
> > Result return in the following order:  
> > 1)  
> > "\_score": 2.1704028,  
> > "\_source": {  
> > "DISPLAY\_NAME": "_Happy_man",
> > 
> > 1. 
> > 
> > "\_score": 1.4312989,  
> > "\_source": {  
> > "DISPLAY\_NAME": "Boishakh (Version 1)",  
> > "PERFORMER": "_Happy_",
> > 
> > 1. 
> > 
> > "\_score": 1.2510761,  
> > "\_source": {  
> > "DISPLAY\_NAME": "Franzl Im Happysound",  
> > "PERFORMER": "Franzl & Die Psayrer",
> > 
> > 1. "\_score": 1.0920545,  
> > "\_source": {  
> > "DISPLAY\_NAME": "_Happy_",  
> > "PERFORMER": "Diandra Arjunaidi"
> > 
> > As the result shown why the #4 have lesser score computed as i already  
> > added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not working  
> > for multimatch phrase query ?
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8Vgo9v\_fXjevnLQeYEEzUJpWVrjjHmj%2BR2NA6XRK5ufg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8Vgo9v_fXjevnLQeYEEzUJpWVrjjHmj%2BR2NA6XRK5ufg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [April 9, 2014, 7:45am UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/4 "2014-04-09T07:45:02Z")

</div>

The boost you define in the 'multi\_match' query is not being show in the  
explain results, so it is not being applied to the score. It should be  
displayed in the weight, i.e.

"description": "weight(DISPLAY\_NAME^8:happy in 33593) [PerFieldSimilarity],  
result of:"

The 'phrase\_prefix' type is the issue, if you remove that type the boost  
will be applied. So it doesn't look like you can combine 'multi\_match'  
boosting with the 'phrase\_prefix' as the type.

Dan

On Tuesday, April 8, 2014 5:15:38 PM UTC+1, cyrilforce wrote:

> Hi Dan,
> 
> I have enabled an analyzer in mapping due to stopword :
> 
> "_DISPLAY\_NAME_": {  
> "type": "string",  
> "_analyzer_": "_standard_"  
> }
> 
> \*The query : \*
> 
> "multi\_match" : {  
> "query" : "_happy_",  
> "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> "type": "_phrase\_prefix_",  
> "operator" : "AND"  
> }
> 
> _The result returned with explain enabled :_  
> _[multimatch\_with\_phrase\_prefix · GitHub](https://gist.github.com/cheehoo/10149517)  
> [https://gist.github.com/cheehoo/10149517](https://gist.github.com/cheehoo/10149517)_
> 
> Thanks
> 
> On Tue, Apr 8, 2014 at 8:44 PM, Dan \<[dan.t...@gmail.com](mailto:dan.t...@gmail.com) \<javascript:\>\>wrote:
> 
> > Turn on the explain feature to see why example 4 is not getting a higher  
> > score.
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-explain.html)
> > 
> > I suspect it has something to do with the way you are indexing your data.  
> > If you still have issues a gist would help us.
> > 
> > Dan
> > 
> > On Tuesday, April 8, 2014 1:11:46 PM UTC+1, cyrilforce wrote:
> > 
> > > Hi,
> > > 
> > > I have a query as below :
> > > 
> > > "multi\_match" : {  
> > > "query" : "_happy_",  
> > > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > > "type": "_phrase\_prefix_",  
> > > "operator" : "AND"  
> > > }
> > > 
> > > Result return in the following order:  
> > > 1)  
> > > "\_score": 2.1704028,  
> > > "\_source": {  
> > > "DISPLAY\_NAME": "_Happy_man",
> > > 
> > > 1. 
> > > 
> > > "\_score": 1.4312989,  
> > > "\_source": {  
> > > "DISPLAY\_NAME": "Boishakh (Version 1)",  
> > > "PERFORMER": "_Happy_",
> > > 
> > > 1. 
> > > 
> > > "\_score": 1.2510761,  
> > > "\_source": {  
> > > "DISPLAY\_NAME": "Franzl Im Happysound",  
> > > "PERFORMER": "Franzl & Die Psayrer",
> > > 
> > > 1. "\_score": 1.0920545,  
> > > "\_source": {  
> > > "DISPLAY\_NAME": "_Happy_",  
> > > "PERFORMER": "Diandra Arjunaidi"
> > > 
> > > As the result shown why the #4 have lesser score computed as i already  
> > > added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not working  
> > > for multimatch phrase query ?
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 9, 2014, 7:53am UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/5 "2014-04-09T07:53:21Z")

</div>

Hi Dan,

Good to know that. So what do you suggest if i wanted to have behavior like  
when i type (search perform in multiple fields eg : DISPLAY\_NAME and  
PERFORMER)

_Hel_

Then it returns (in the following order) :  
_Hel_l  
_Hel_p  
_Hel_lo  
_Hel_lo World

On Wed, Apr 9, 2014 at 3:45 PM, Dan Tuffery [dan.tuffery@gmail.com](mailto:dan.tuffery@gmail.com) wrote:

> The boost you define in the 'multi\_match' query is not being show in the  
> explain results, so it is not being applied to the score. It should be  
> displayed in the weight, i.e.
> 
> "description": "weight(DISPLAY\_NAME^8:happy in 33593)  
> [PerFieldSimilarity], result of:"
> 
> The 'phrase\_prefix' type is the issue, if you remove that type the boost  
> will be applied. So it doesn't look like you can combine 'multi\_match'  
> boosting with the 'phrase\_prefix' as the type.
> 
> Dan
> 
> On Tuesday, April 8, 2014 5:15:38 PM UTC+1, cyrilforce wrote:
> 
> > Hi Dan,
> > 
> > I have enabled an analyzer in mapping due to stopword :
> > 
> > "_DISPLAY\_NAME_": {  
> > "type": "string",  
> > "_analyzer_": "_standard_"  
> > }
> > 
> > \*The query : \*
> > 
> > "multi\_match" : {  
> > "query" : "_happy_",  
> > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > "type": "_phrase\_prefix_",  
> > "operator" : "AND"  
> > }
> > 
> > _The result returned with explain enabled :_  
> > _[multimatch\_with\_phrase\_prefix · GitHub](https://gist.github.com/cheehoo/10149517)  
> > [https://gist.github.com/cheehoo/10149517](https://gist.github.com/cheehoo/10149517)_
> > 
> > Thanks
> > 
> > On Tue, Apr 8, 2014 at 8:44 PM, Dan [dan.t...@gmail.com](mailto:dan.t...@gmail.com) wrote:
> > 
> > > Turn on the explain feature to see why example 4 is not getting a  
> > > higher score.
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/)  
> > > reference/current/search-explain.html
> > > 
> > > I suspect it has something to do with the way you are indexing your  
> > > data. If you still have issues a gist would help us.
> > > 
> > > Dan
> > > 
> > > On Tuesday, April 8, 2014 1:11:46 PM UTC+1, cyrilforce wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I have a query as below :
> > > > 
> > > > "multi\_match" : {  
> > > > "query" : "_happy_",  
> > > > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > > > "type": "_phrase\_prefix_",  
> > > > "operator" : "AND"  
> > > > }
> > > > 
> > > > Result return in the following order:  
> > > > 1)  
> > > > "\_score": 2.1704028,  
> > > > "\_source": {  
> > > > "DISPLAY\_NAME": "_Happy_man",
> > > > 
> > > > 1. 
> > > > 
> > > > "\_score": 1.4312989,  
> > > > "\_source": {  
> > > > "DISPLAY\_NAME": "Boishakh (Version 1)",  
> > > > "PERFORMER": "_Happy_",
> > > > 
> > > > 1. 
> > > > 
> > > > "\_score": 1.2510761,  
> > > > "\_source": {  
> > > > "DISPLAY\_NAME": "Franzl Im Happysound",  
> > > > "PERFORMER": "Franzl & Die Psayrer",
> > > > 
> > > > 1. "\_score": 1.0920545,  
> > > > "\_source": {  
> > > > "DISPLAY\_NAME": "_Happy_",  
> > > > "PERFORMER": "Diandra Arjunaidi"
> > > > 
> > > > As the result shown why the #4 have lesser score computed as i already  
> > > > added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not working  
> > > > for multimatch phrase query ?
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe.  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%  
> > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Regards,
> > 
> > Chee Hoo
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8cw-dfQJCc1Gp4DUre34COBXwW3qzwV8Pii8dKPL4w1A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8cw-dfQJCc1Gp4DUre34COBXwW3qzwV8Pii8dKPL4w1A%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)\
**Post date:** [April 9, 2014, 7:24pm UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/6 "2014-04-09T19:24:52Z")

</div>

You could use edge ngrams:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Or if you have the correct version of Elasticsearch, you can use the  
Completion Suggester:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Dan

On Wednesday, April 9, 2014 8:53:21 AM UTC+1, cyrilforce wrote:

> Hi Dan,
> 
> Good to know that. So what do you suggest if i wanted to have behavior  
> like when i type (search perform in multiple fields eg : DISPLAY\_NAME and  
> PERFORMER)
> 
> _Hel_
> 
> Then it returns (in the following order) :  
> _Hel_l  
> _Hel_p  
> _Hel_lo  
> _Hel_lo World
> 
> On Wed, Apr 9, 2014 at 3:45 PM, Dan Tuffery \<[dan.t...@gmail.com](mailto:dan.t...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > The boost you define in the 'multi\_match' query is not being show in the  
> > explain results, so it is not being applied to the score. It should be  
> > displayed in the weight, i.e.
> > 
> > "description": "weight(DISPLAY\_NAME^8:happy in 33593)  
> > [PerFieldSimilarity], result of:"
> > 
> > The 'phrase\_prefix' type is the issue, if you remove that type the boost  
> > will be applied. So it doesn't look like you can combine 'multi\_match'  
> > boosting with the 'phrase\_prefix' as the type.
> > 
> > Dan
> > 
> > On Tuesday, April 8, 2014 5:15:38 PM UTC+1, cyrilforce wrote:
> > 
> > > Hi Dan,
> > > 
> > > I have enabled an analyzer in mapping due to stopword :
> > > 
> > > "_DISPLAY\_NAME_": {  
> > > "type": "string",  
> > > "_analyzer_": "_standard_"  
> > > }
> > > 
> > > \*The query : \*
> > > 
> > > "multi\_match" : {  
> > > "query" : "_happy_",  
> > > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > > "type": "_phrase\_prefix_",  
> > > "operator" : "AND"  
> > > }
> > > 
> > > _The result returned with explain enabled :_  
> > > _[multimatch\_with\_phrase\_prefix · GitHub](https://gist.github.com/cheehoo/10149517)  
> > > [https://gist.github.com/cheehoo/10149517](https://gist.github.com/cheehoo/10149517)_
> > > 
> > > Thanks
> > > 
> > > On Tue, Apr 8, 2014 at 8:44 PM, Dan [dan.t...@gmail.com](mailto:dan.t...@gmail.com) wrote:
> > > 
> > > > Turn on the explain feature to see why example 4 is not getting a  
> > > > higher score.
> > > > 
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/)  
> > > > reference/current/search-explain.html
> > > > 
> > > > I suspect it has something to do with the way you are indexing your  
> > > > data. If you still have issues a gist would help us.
> > > > 
> > > > Dan
> > > > 
> > > > On Tuesday, April 8, 2014 1:11:46 PM UTC+1, cyrilforce wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I have a query as below :
> > > > > 
> > > > > "multi\_match" : {  
> > > > > "query" : "_happy_",  
> > > > > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > > > > "type": "_phrase\_prefix_",  
> > > > > "operator" : "AND"  
> > > > > }
> > > > > 
> > > > > Result return in the following order:  
> > > > > 1)  
> > > > > "\_score": 2.1704028,  
> > > > > "\_source": {  
> > > > > "DISPLAY\_NAME": "_Happy_man",
> > > > > 
> > > > > 1. 
> > > > > 
> > > > > "\_score": 1.4312989,  
> > > > > "\_source": {  
> > > > > "DISPLAY\_NAME": "Boishakh (Version 1)",  
> > > > > "PERFORMER": "_Happy_",
> > > > > 
> > > > > 1. 
> > > > > 
> > > > > "\_score": 1.2510761,  
> > > > > "\_source": {  
> > > > > "DISPLAY\_NAME": "Franzl Im Happysound",  
> > > > > "PERFORMER": "Franzl & Die Psayrer",
> > > > > 
> > > > > 1. "\_score": 1.0920545,  
> > > > > "\_source": {  
> > > > > "DISPLAY\_NAME": "_Happy_",  
> > > > > "PERFORMER": "Diandra Arjunaidi"
> > > > > 
> > > > > As the result shown why the #4 have lesser score computed as i already  
> > > > > added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not working  
> > > > > for multimatch phrase query ?
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe.  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%  
> > > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Regards,
> > > 
> > > Chee Hoo
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/608341a2-0d83-48cc-9126-40499553c58b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/608341a2-0d83-48cc-9126-40499553c58b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 10, 2014, 10:23am UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/7 "2014-04-10T10:23:51Z")

</div>

Hi Dan,

Been trying to use edgengram analyzer but i don't understand why it produce  
the result in the following order :

1. "DISPLAY\_NAME": "Happy Talk"
2. "DISPLAY\_NAME": "Happenings",

I suppose the longer the text ("Happy Talk") it should have lower the  
scores ?

\*The query that i use : \*  
{ "explain" : true,  
"query" : {  
"multi\_match": {  
"query": "_hap_",  
"fields": ["DISPLAY\_NAME.AUTOCOMPLETE^6", "PERFORMER.AUTOCOMPLETE"]  
}  
},  
"sort" : [{  
"\_score" : { "order" : "desc"}}]  
}

_The result :_

> <https://gist.github.com/cheehoo/10365281>

_The mapping :_

"DISPLAY\_NAME": {  
"type": "multi\_field",  
"fields": {  
"AUTOCOMPLETE": {  
"type": "string",  
"analyzer": "edge\_ngram\_keyword\_lowercase\_analyzer",  
"include\_in\_all": false  
},  
"NAME": {  
"type": "string",  
"analyzer": "standard",  
"include\_in\_all": false  
}  
}  
},  
"PERFORMER": {  
"type": "multi\_field",  
"fields": {  
"AUTOCOMPLETE": {  
"type": "string",  
"analyzer": "edge\_ngram\_keyword\_lowercase\_analyzer",  
"include\_in\_all": false  
},  
"NAME": {  
"type": "string",  
"analyzer": "standard",  
"include\_in\_all": false  
}  
}  
},

\*And the analyzer settings: \*  
{  
"jdbc\_dev": {  
"settings": {  
"index.analysis.analyzer.string\_lowercase.filter": "lowercase",  
"index.number\_of\_replicas": "1",  
"index.version.created": "900299",  
"index.number\_of\_shards": "5",  
"index.analysis.analyzer.string\_lowercase.tokenizer": "keyword",

"index.analysis.tokenizer.my\_edge\_ngram\_tokenizer.token\_chars.0": "letter",  
"index.analysis.tokenizer.my\_edge\_ngram\_tokenizer.min\_gram":  
"2",

"index.analysis.tokenizer.my\_edge\_ngram\_tokenizer.token\_chars.1": "digit",  
"index.analysis.tokenizer.my\_edge\_ngram\_tokenizer.type":  
"edgeNGram",  
"index.analysis.tokenizer.my\_edge\_ngram\_tokenizer.max\_gram":  
"5",

"index.analysis.analyzer.edge\_ngram\_keyword\_lowercase\_analyzer.filter.1":  
"lowercase",

"index.analysis.analyzer.edge\_ngram\_keyword\_lowercase\_analyzer.filter.0":  
"my\_edge\_ngram\_filter",

"index.analysis.analyzer.edge\_ngram\_keyword\_lowercase\_analyzer.tokenizer":  
"keyword",  
"index.analysis.filter.my\_edge\_ngram\_filter.type": "edgeNGram",  
"index.analysis.filter.my\_edge\_ngram\_filter.min\_gram": "2",  
"index.analysis.filter.my\_edge\_ngram\_filter.max\_gram": "30"  
}  
}  
}

Thanks.

On Thu, Apr 10, 2014 at 3:24 AM, Dan Tuffery [dan.tuffery@gmail.com](mailto:dan.tuffery@gmail.com) wrote:

> You could use edge ngrams:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenizer.html)
> 
> Or if you have the correct version of Elasticsearch, you can use the  
> Completion Suggester:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/you-complete-me/)
> 
> Dan
> 
> On Wednesday, April 9, 2014 8:53:21 AM UTC+1, cyrilforce wrote:
> 
> > Hi Dan,
> > 
> > Good to know that. So what do you suggest if i wanted to have behavior  
> > like when i type (search perform in multiple fields eg : DISPLAY\_NAME and  
> > PERFORMER)
> > 
> > _Hel_
> > 
> > Then it returns (in the following order) :  
> > _Hel_l  
> > _Hel_p  
> > _Hel_lo  
> > _Hel_lo World
> > 
> > On Wed, Apr 9, 2014 at 3:45 PM, Dan Tuffery [dan.t...@gmail.com](mailto:dan.t...@gmail.com) wrote:
> > 
> > > The boost you define in the 'multi\_match' query is not being show in the  
> > > explain results, so it is not being applied to the score. It should be  
> > > displayed in the weight, i.e.
> > > 
> > > "description": "weight(DISPLAY\_NAME^8:happy in 33593)  
> > > [PerFieldSimilarity], result of:"
> > > 
> > > The 'phrase\_prefix' type is the issue, if you remove that type the boost  
> > > will be applied. So it doesn't look like you can combine 'multi\_match'  
> > > boosting with the 'phrase\_prefix' as the type.
> > > 
> > > Dan
> > > 
> > > On Tuesday, April 8, 2014 5:15:38 PM UTC+1, cyrilforce wrote:
> > > 
> > > > Hi Dan,
> > > > 
> > > > I have enabled an analyzer in mapping due to stopword :
> > > > 
> > > > "_DISPLAY\_NAME_": {  
> > > > "type": "string",  
> > > > "_analyzer_": "_standard_"  
> > > > }
> > > > 
> > > > \*The query : \*
> > > > 
> > > > "multi\_match" : {  
> > > > "query" : "_happy_",  
> > > > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > > > "type": "_phrase\_prefix_",  
> > > > "operator" : "AND"  
> > > > }
> > > > 
> > > > _The result returned with explain enabled :_  
> > > > _[multimatch\_with\_phrase\_prefix · GitHub](https://gist.github.com/cheehoo/10149517)  
> > > > [https://gist.github.com/cheehoo/10149517](https://gist.github.com/cheehoo/10149517)_
> > > > 
> > > > Thanks
> > > > 
> > > > On Tue, Apr 8, 2014 at 8:44 PM, Dan [dan.t...@gmail.com](mailto:dan.t...@gmail.com) wrote:
> > > > 
> > > > > Turn on the explain feature to see why example 4 is not getting a  
> > > > > higher score.
> > > > > 
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/referenc)  
> > > > > e/current/search-explain.html
> > > > > 
> > > > > I suspect it has something to do with the way you are indexing your  
> > > > > data. If you still have issues a gist would help us.
> > > > > 
> > > > > Dan
> > > > > 
> > > > > On Tuesday, April 8, 2014 1:11:46 PM UTC+1, cyrilforce wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I have a query as below :
> > > > > > 
> > > > > > "multi\_match" : {  
> > > > > > "query" : "_happy_",  
> > > > > > "fields" : [_"DISPLAY\_NAME^8_", "_PERFORMER_"],  
> > > > > > "type": "_phrase\_prefix_",  
> > > > > > "operator" : "AND"  
> > > > > > }
> > > > > > 
> > > > > > Result return in the following order:  
> > > > > > 1)  
> > > > > > "\_score": 2.1704028,  
> > > > > > "\_source": {  
> > > > > > "DISPLAY\_NAME": "_Happy_man",
> > > > > > 
> > > > > > 1. 
> > > > > > 
> > > > > > "\_score": 1.4312989,  
> > > > > > "\_source": {  
> > > > > > "DISPLAY\_NAME": "Boishakh (Version 1)",  
> > > > > > "PERFORMER": "_Happy_",
> > > > > > 
> > > > > > 1. 
> > > > > > 
> > > > > > "\_score": 1.2510761,  
> > > > > > "\_source": {  
> > > > > > "DISPLAY\_NAME": "Franzl Im Happysound",  
> > > > > > "PERFORMER": "Franzl & Die Psayrer",
> > > > > > 
> > > > > > 1. "\_score": 1.0920545,  
> > > > > > "\_source": {  
> > > > > > "DISPLAY\_NAME": "_Happy_",  
> > > > > > "PERFORMER": "Diandra Arjunaidi"
> > > > > > 
> > > > > > As the result shown why the #4 have lesser score computed as i  
> > > > > > already added a boost in the "DISPLAY\_NAME^6" field. Is that the boost not  
> > > > > > working for multimatch phrase query ?
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in the  
> > > > > > Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/to](https://groups.google.com/d/to)  
> > > > > > pic/elasticsearch/yEAJ0Ym8PrU/unsubscribe.  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40goo  
> > > > > > [glegroups.com](http://glegroups.com)[https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/bfd38ce9-13b0-4d25-912f-28036992a6df%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > Regards,
> > > > 
> > > > Chee Hoo
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe.  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%  
> > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/96218594-90b7-43f4-a0f5-497da059c2f9%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Regards,
> > 
> > Chee Hoo
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/yEAJ0Ym8PrU/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/608341a2-0d83-48cc-9126-40499553c58b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/608341a2-0d83-48cc-9126-40499553c58b%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/608341a2-0d83-48cc-9126-40499553c58b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/608341a2-0d83-48cc-9126-40499553c58b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8hzpscJ%2Bj8tmZVGuc-mSy6PKT5O5cQYtBwKtjPQ6Or7g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8hzpscJ%2Bj8tmZVGuc-mSy6PKT5O5cQYtBwKtjPQ6Or7g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:36am UTC](https://discuss.elastic.co/t/multimatch-with-phrase-prefix-support-for-boost/16873/8 "2017-07-06T01:36:55Z")

</div>


