# How to get certain documents to rank higher than others in a general sense

**URL:** https://discuss.elastic.co/t/how-to-get-certain-documents-to-rank-higher-than-others-in-a-general-sense/16645
**Category:** Elasticsearch
**Created:** [March 27, 2014, 3:27pm UTC](https://discuss.elastic.co/t/how-to-get-certain-documents-to-rank-higher-than-others-in-a-general-sense/16645 "2014-03-27T15:27:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kelly\_Sauke](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@Kelly\_Sauke](https://discuss.elastic.co/u/Kelly_Sauke)
#### Post date: [March 27, 2014, 3:27pm UTC](https://discuss.elastic.co/t/how-to-get-certain-documents-to-rank-higher-than-others-in-a-general-sense/16645/1 "2014-03-27T15:27:19Z")

</div>

Everyone-

How would you solve this issue?

I'm building a product search but I'm running into issues with  
generalizing how boosting happens. In one example I search for the term  
"ladder" and I get results where the terms "ladder parts" and "ladder  
wheels" are higher than "step ladder" or "platform ladder". In other  
cases I want a higher ranking where the search term exists at the  
beginning of matched string as opposed to the end. How do I go in and  
boost those specific documents but only for specific search terms? Is  
that possible?

I'm using the snowball analyzer with English language. Perhaps there is  
a better analyzer to use?

Thanks for your help!  
-Kelly

--  
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/53344357.4080007%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/53344357.4080007%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 31, 2014, 7:44am UTC](https://discuss.elastic.co/t/how-to-get-certain-documents-to-rank-higher-than-others-in-a-general-sense/16645/2 "2014-03-31T07:44:49Z")

</div>

Hey,

scoring is generally one of the more complex parts of search, not because  
it uses math, but because everyone defines relevancy different. If you are  
interested, how scoring works generally, take the time to read  
[https://lucene.apache.org/core/4\_7\_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html](https://lucene.apache.org/core/4_7_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html)

However, in most real applications you would want to change the scoring on  
different parameter of a document, for example if your are running a  
bidding site or a news portal, time is an important factor. This is why the  
function\_score has been added to elasticsearch, see

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

Another interesting thing might be to score documents up, where two search  
terms are near to each other and so forth...  
The freshly released definitive guide (a not yet fully complete online  
book) gives a really great introduction into this, see

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

The question is, do you really want to work on such single term examples  
like the ladder one, to heavily affect your scores or does it make more  
sense to take more than full-text search into account to achieve your  
requirements? Also, dont mix it up with relational databases on how those  
queries work.

Hope this helps as a start.

--Alex

On Thu, Mar 27, 2014 at 4:27 PM, Kelly Sauke [ksauke@gmail.com](mailto:ksauke@gmail.com) wrote:

> Everyone-
> 
> How would you solve this issue?
> 
> I'm building a product search but I'm running into issues with  
> generalizing how boosting happens. In one example I search for the term  
> "ladder" and I get results where the terms "ladder parts" and "ladder  
> wheels" are higher than "step ladder" or "platform ladder". In other cases  
> I want a higher ranking where the search term exists at the beginning of  
> matched string as opposed to the end. How do I go in and boost those  
> specific documents but only for specific search terms? Is that possible?
> 
> I'm using the snowball analyzer with English language. Perhaps there is a  
> better analyzer to use?
> 
> Thanks for your help!  
> -Kelly
> 
> --  
> 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/](https://groups.google.com/d/)  
> msgid/elasticsearch/53344357.4080007%[40gmail.com](http://40gmail.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGCwEM9vPxHBzOMXkp3Wex-Jr5xx5crGYEYpkvzeZorizTzAvw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9vPxHBzOMXkp3Wex-Jr5xx5crGYEYpkvzeZorizTzAvw%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:39am UTC](https://discuss.elastic.co/t/how-to-get-certain-documents-to-rank-higher-than-others-in-a-general-sense/16645/3 "2017-07-06T01:39:29Z")

</div>


