# Multi-match query : how to improve results?

**URL:** https://discuss.elastic.co/t/multi-match-query-how-to-improve-results/13123
**Category:** Elasticsearch
**Created:** [August 8, 2013, 8:38am UTC](https://discuss.elastic.co/t/multi-match-query-how-to-improve-results/13123 "2013-08-08T08:38:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Damien\_Ferey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_ferey/32/536_2.png) [@Damien\_Ferey](https://discuss.elastic.co/u/Damien_Ferey)
#### Post date: [August 8, 2013, 8:38am UTC](https://discuss.elastic.co/t/multi-match-query-how-to-improve-results/13123/1 "2013-08-08T08:38:24Z")

</div>

Hello,

I've got a list of schools indexed in my Elasticsearch, and I use it as a  
source for a form field autocompletion.

There are two main fields : description & city.  
(these two fields are fully ngram indexed)

Here are sample data:

| description | city |  
+-------------+-----------+  
| COLLEGE FOO | Paris |  
| COLLEGE BAR | Marseille |  
| LYCEE DUMMY | Lyon |

Here is the query I'm using :

QueryBuilder queryNgram = QueryBuilders.multiMatchQuery(queryString,  
"description",  
"city"  
)  
.tieBreaker(1f)

When I start searching "_coll_" =\> OK, Elasticsearch retrives both colleges.

When I search"_coll foo_" or "_coll bar_" however, both colleges are still  
retrieved, and both have the same score.  
Is it possible to increase score when multiple tokens of a field are  
matched ?  
(when I type "_coll foo_", I would like that "_COLLEGE FOO_" have an higher  
score than "_COLLEGE BAR_")  
(when I type "_coll bar_", I would like that "_COLLEGE BAR_" have an higher  
score than "_COLLEGE FOO_")

(and yes, I still want to search among both description and city)

Thank you !

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Damien\_Ferey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_ferey/32/536_2.png) [@Damien\_Ferey](https://discuss.elastic.co/u/Damien_Ferey)
#### Post date: [August 8, 2013, 12:13pm UTC](https://discuss.elastic.co/t/multi-match-query-how-to-improve-results/13123/2 "2013-08-08T12:13:10Z")

</div>

my fault, Elasticsearch returns results with higher score as I wanted, it's  
my js stack that sorted items by id afterward...  
problem solved...

Damien

Le jeudi 8 août 2013 10:38:24 UTC+2, Damien Ferey a écrit :

> Hello,
> 
> I've got a list of schools indexed in my Elasticsearch, and I use it as a  
> source for a form field autocompletion.
> 
> There are two main fields : description & city.  
> (these two fields are fully ngram indexed)
> 
> Here are sample data:
> 
> | description | city |  
> +-------------+-----------+  
> | COLLEGE FOO | Paris |  
> | COLLEGE BAR | Marseille |  
> | LYCEE DUMMY | Lyon |
> 
> Here is the query I'm using :
> 
> QueryBuilder queryNgram = QueryBuilders.multiMatchQuery(queryString,  
> "description",  
> "city"  
> )  
> .tieBreaker(1f)
> 
> When I start searching "_coll_" =\> OK, Elasticsearch retrives both  
> colleges.
> 
> When I search"_coll foo_" or "_coll bar_" however, both colleges are  
> still retrieved, and both have the same score.  
> Is it possible to increase score when multiple tokens of a field are  
> matched ?  
> (when I type "_coll foo_", I would like that "_COLLEGE FOO_" have an  
> higher score than "_COLLEGE BAR_")  
> (when I type "_coll bar_", I would like that "_COLLEGE BAR_" have an  
> higher score than "_COLLEGE FOO_")
> 
> (and yes, I still want to search among both description and city)
> 
> Thank you !

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:22am UTC](https://discuss.elastic.co/t/multi-match-query-how-to-improve-results/13123/3 "2017-07-06T02:22:08Z")

</div>


