# Scoring rules : Text based search

**URL:** <https://discuss.elastic.co/t/scoring-rules-text-based-search/15403>\
**Category:** Elasticsearch\
**Created:** [January 24, 2014, 11:20am UTC](https://discuss.elastic.co/t/scoring-rules-text-based-search/15403 "2014-01-24T11:20:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hiro\_Gangwani](https://avatars.discourse-cdn.com/v4/letter/h/9fc29f/32.png) [@Hiro\_Gangwani](https://discuss.elastic.co/u/Hiro_Gangwani)\
**Post date:** [January 24, 2014, 11:20am UTC](https://discuss.elastic.co/t/scoring-rules-text-based-search/15403/1 "2014-01-24T11:20:03Z")

</div>

Dear Team,  
We are doing indexing of document contents (Like word, PDF) in ES 0.90  
version. Our application primarily uses text based search features from  
document content. Our search criteria is as follows.

1. All of keywords
2. Any of keywords

We need to give highest priority to all of key words than any of keywords  
search criteria. In other words based upon word count documents having all  
of the key words should be shown first (High relevancy) then any of key  
words. For this purpose we have applied highest boost factor to All of  
keywords field than any of key words fields. Despite applying higher boost  
factor we get results with document having less count of words with highest  
score. Upon analyzing we found that size of document also plays role while  
deciding the score. e.g document 1 (137KB) has 60 matching keywords and  
document 2 (56kb) has 49 matching words. Despite this document 2 is shown  
first having higher score than document 1. I think size of document matters  
while deciding the relevancy and score.

Is there mechanism to assign higher score based upon count of word as  
defined in search criteria so that same is shown as top? We are using Java  
API to query from ES indexes.

Thanks,

Hiro.

--  
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/2b0c9b52-6452-4881-968d-30734c8b86b8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2b0c9b52-6452-4881-968d-30734c8b86b8%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Nikolay\_Chankov](https://avatars.discourse-cdn.com/v4/letter/n/a8b319/32.png) [@Nikolay\_Chankov](https://discuss.elastic.co/u/Nikolay_Chankov)\
**Post date:** [January 24, 2014, 3:42pm UTC](https://discuss.elastic.co/t/scoring-rules-text-based-search/15403/2 "2014-01-24T15:42:30Z")

</div>

In Lucene one of the scoring criteria is the size of the field (in your  
case the document) as shorter it is, the score is bigger, but the score  
with multiple keywords rather than single one is strange. Are you sue that  
the words are matching? Could you provide your search query?

On Friday, January 24, 2014 11:20:03 AM UTC, Hiro Gangwani wrote:

> Dear Team,  
> We are doing indexing of document contents (Like word, PDF) in ES 0.90  
> version. Our application primarily uses text based search features from  
> document content. Our search criteria is as follows.
> 
> 1. All of keywords
> 2. Any of keywords
> 
> We need to give highest priority to all of key words than any of keywords  
> search criteria. In other words based upon word count documents having all  
> of the key words should be shown first (High relevancy) then any of key  
> words. For this purpose we have applied highest boost factor to All of  
> keywords field than any of key words fields. Despite applying higher boost  
> factor we get results with document having less count of words with highest  
> score. Upon analyzing we found that size of document also plays role while  
> deciding the score. e.g document 1 (137KB) has 60 matching keywords and  
> document 2 (56kb) has 49 matching words. Despite this document 2 is shown  
> first having higher score than document 1. I think size of document matters  
> while deciding the relevancy and score.
> 
> Is there mechanism to assign higher score based upon count of word as  
> defined in search criteria so that same is shown as top? We are using Java  
> API to query from ES indexes.
> 
> Thanks,
> 
> Hiro.

--  
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/c7fc5d7c-cf9b-41b9-abb8-697dc8ea1521%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c7fc5d7c-cf9b-41b9-abb8-697dc8ea1521%40googlegroups.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, 1:54am UTC](https://discuss.elastic.co/t/scoring-rules-text-based-search/15403/3 "2017-07-06T01:54:58Z")

</div>


