# Scoring problem

**URL:** <https://discuss.elastic.co/t/scoring-problem/10155>\
**Category:** Elasticsearch\
**Created:** [December 21, 2012, 2:48pm UTC](https://discuss.elastic.co/t/scoring-problem/10155 "2012-12-21T14:48:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal\_Dorini](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pascal\_Dorini](https://discuss.elastic.co/u/Pascal_Dorini)\
**Post date:** [December 21, 2012, 2:48pm UTC](https://discuss.elastic.co/t/scoring-problem/10155/1 "2012-12-21T14:48:42Z")

</div>

Hi,

I will try to explain my problem:

I have a request "A B C" where A, B and C are 3 common words. this words  
are present in a lot of documents.  
The most important document for this request contain the 3 words one time  
and they are adjacent.  
The document has a bad score and I would like to boost it.

Any idea ? Is-it possible to apply a word distance boost ? Is it possible  
to index "A B C" has one word ?

Thanks for your help

--

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [December 21, 2012, 2:51pm UTC](https://discuss.elastic.co/t/scoring-problem/10155/2 "2012-12-21T14:51:59Z")

</div>

Hello!

Will phrase query help in your case ? You can configure slop, which gives you control over how distant the words can be from each other to consider them as a phrase. Wrapping that with a custom score would boost the documents you are interested in.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

Hi,

I will try to explain my problem:

I have a request "A B C" where A, B and C are 3 common words. this words are present in a lot of documents.

The most important document for this request contain the 3 words one time and they are adjacent.

The document has a bad score and I would like to boost it.

Any idea ? Is-it possible to apply a word distance boost ? Is it possible to index "A B C" has one word ?

Thanks for your help

--

---

<div class="post-metadata">

**Author:** ![Pascal\_Dorini](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pascal\_Dorini](https://discuss.elastic.co/u/Pascal_Dorini)\
**Post date:** [December 24, 2012, 8:58am UTC](https://discuss.elastic.co/t/scoring-problem/10155/3 "2012-12-24T08:58:02Z")

</div>

Ok, so now i have 2 queries :

1- Using "Query phrase" :

"query": {  
"match": {  
"\_all" : {  
"query" : "$KW",  
"type" : "phrase",  
"slop" : "1"  
}  
}  
}

On Friday, December 21, 2012 3:51:59 PM UTC+1, Rafał Kuć wrote:

> Hello!
> 
> Will phrase query help in your case ? You can configure slop, which gives  
> you control over how distant the words can be from each other to consider  
> them as a phrase. Wrapping that with a custom score would boost the  
> documents you are interested in.  
> \*--  
> Regards,  
> Rafał Kuć  
> Sematext :: _[http://sematext.com/](http://sematext.com/)_ :: Solr - Lucene - Nutch -  
> Elasticsearch
> 
> - 
> 
> Hi,
> 
> I will try to explain my problem:
> 
> I have a request "A B C" where A, B and C are 3 common words. this words  
> are present in a lot of documents.  
> The most important document for this request contain the 3 words one time  
> and they are adjacent.  
> The document has a bad score and I would like to boost it.
> 
> Any idea ? Is-it possible to apply a word distance boost ? Is it possible  
> to index "A B C" has one word ?
> 
> ## Thanks for your help

--

---

<div class="post-metadata">

**Author:** ![Pascal\_Dorini](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pascal\_Dorini](https://discuss.elastic.co/u/Pascal_Dorini)\
**Post date:** [December 24, 2012, 9:04am UTC](https://discuss.elastic.co/t/scoring-problem/10155/4 "2012-12-24T09:04:03Z")

</div>

Ok, so now i have 2 queries :

1- Using "Query phrase" :

"query": {  
"match": {  
"\_all" : {  
"query" : "test",  
"type" : "phrase",  
"slop" : "1"  
}  
}  
}

1- using Query string

"query": {  
"query\_string" : {  
"fields" : ["faq\_titre","faq\_contenu", "forcage"],  
"query": "test"  
}  
}

Now I want to combine the queries. If I understand your answer I should use  
the custom score but I am not sure to understand how it works.

On Friday, December 21, 2012 3:51:59 PM UTC+1, Rafał Kuć wrote:

> Hello!
> 
> Will phrase query help in your case ? You can configure slop, which gives  
> you control over how distant the words can be from each other to consider  
> them as a phrase. Wrapping that with a custom score would boost the  
> documents you are interested in.  
> \*--  
> Regards,  
> Rafał Kuć  
> Sematext :: _[http://sematext.com/](http://sematext.com/)_ :: Solr - Lucene - Nutch -  
> Elasticsearch
> 
> - 
> 
> Hi,
> 
> I will try to explain my problem:
> 
> I have a request "A B C" where A, B and C are 3 common words. this words  
> are present in a lot of documents.  
> The most important document for this request contain the 3 words one time  
> and they are adjacent.  
> The document has a bad score and I would like to boost it.
> 
> Any idea ? Is-it possible to apply a word distance boost ? Is it possible  
> to index "A B C" has one word ?
> 
> ## Thanks for your help

--

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [December 24, 2012, 3:06pm UTC](https://discuss.elastic.co/t/scoring-problem/10155/5 "2012-12-24T15:06:08Z")

</div>

You can wrap the two queries in a bool query and optionally supply a query  
time boost to each clause:

> **[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.

On 24 December 2012 10:04, Pascal Dorini [pdorini@gmail.com](mailto:pdorini@gmail.com) wrote:

> Ok, so now i have 2 queries :
> 
> 1- Using "Query phrase" :
> 
> "query": {  
> \*\* "match": {  
> "\_all" : {  
> "query" : "test",
> 
> ```
> "type\" : "phrase",
> "slop" : "1"
> }
> }
> }
> 
> ```
> 
> 1- using Query string
> 
> "query": {  
> "query\_string" : {  
> "fields" : ["faq\_titre","faq\_contenu", "forcage"],  
> "query": "test"  
> }  
> }
> 
> Now I want to combine the queries. If I understand your answer I should  
> use the custom score but I am not sure to understand how it works.
> 
> On Friday, December 21, 2012 3:51:59 PM UTC+1, Rafał Kuć wrote:
> 
> > Hello!
> > 
> > Will phrase query help in your case ? You can configure slop, which gives  
> > you control over how distant the words can be from each other to consider  
> > them as a phrase. Wrapping that with a custom score would boost the  
> > documents you are interested in.  
> > \*--  
> > Regards,  
> > Rafał Kuć  
> > Sematext :: _[http://sematext.com/](http://sematext.com/)_ :: Solr - Lucene - Nutch -  
> > Elasticsearch
> > 
> > - 
> > 
> > Hi,
> > 
> > I will try to explain my problem:
> > 
> > I have a request "A B C" where A, B and C are 3 common words. this words  
> > are present in a lot of documents.  
> > The most important document for this request contain the 3 words one  
> > time and they are adjacent.  
> > The document has a bad score and I would like to boost it.
> > 
> > Any idea ? Is-it possible to apply a word distance boost ? Is it possible  
> > to index "A B C" has one word ?
> > 
> > ## Thanks for your help
> 
> --

--  
Met vriendelijke groet,

Martijn van Groningen

--

---

<div class="post-metadata">

**Author:** ![Pascal\_Dorini](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@Pascal\_Dorini](https://discuss.elastic.co/u/Pascal_Dorini)\
**Post date:** [December 26, 2012, 7:58am UTC](https://discuss.elastic.co/t/scoring-problem/10155/6 "2012-12-26T07:58:21Z")

</div>

It works, thanks for your help.

On Monday, December 24, 2012 4:06:08 PM UTC+1, Martijn v Groningen wrote:

> You can wrap the two queries in a bool query and optionally supply a query  
> time boost to each clause:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html)
> 
> On 24 December 2012 10:04, Pascal Dorini \<[pdo...@gmail.com](mailto:pdo...@gmail.com) \<javascript:\>\>wrote:
> 
> > Ok, so now i have 2 queries :
> > 
> > 1- Using "Query phrase" :
> > 
> > "query": {  
> > \*\* "match": {  
> > "\_all" : {  
> > "query" : "test",
> > 
> > ```
> > "type\" : "phrase",
> > "slop" : "1"
> > }
> > }
> > }
> > 
> > ```
> > 
> > 1- using Query string
> > 
> > "query": {  
> > "query\_string" : {  
> > "fields" : ["faq\_titre","faq\_contenu", "forcage"],  
> > "query": "test"  
> > }  
> > }
> > 
> > Now I want to combine the queries. If I understand your answer I should  
> > use the custom score but I am not sure to understand how it works.
> > 
> > On Friday, December 21, 2012 3:51:59 PM UTC+1, Rafał Kuć wrote:
> > 
> > > Hello!
> > > 
> > > Will phrase query help in your case ? You can configure slop, which  
> > > gives you control over how distant the words can be from each other to  
> > > consider them as a phrase. Wrapping that with a custom score would boost  
> > > the documents you are interested in.  
> > > \*--  
> > > Regards,  
> > > Rafał Kuć  
> > > Sematext :: _[http://sematext.com/](http://sematext.com/)_ :: Solr - Lucene - Nutch -  
> > > Elasticsearch
> > > 
> > > - 
> > > 
> > > Hi,
> > > 
> > > I will try to explain my problem:
> > > 
> > > I have a request "A B C" where A, B and C are 3 common words. this words  
> > > are present in a lot of documents.  
> > > The most important document for this request contain the 3 words one  
> > > time and they are adjacent.  
> > > The document has a bad score and I would like to boost it.
> > > 
> > > Any idea ? Is-it possible to apply a word distance boost ? Is it  
> > > possible to index "A B C" has one word ?
> > > 
> > > ## Thanks for your help
> > 
> > --
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--

---

<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:58am UTC](https://discuss.elastic.co/t/scoring-problem/10155/7 "2017-07-06T02:58:28Z")

</div>

Closed on July 6, 2017, 2:58am UTC


