# Elastic Search Scoring - Query Terms Boost

**URL:** <https://discuss.elastic.co/t/elastic-search-scoring-query-terms-boost/16420>\
**Category:** Elasticsearch\
**Created:** [March 18, 2014, 10:25am UTC](https://discuss.elastic.co/t/elastic-search-scoring-query-terms-boost/16420 "2014-03-18T10:25:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pratik\_Poddar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pratik_poddar/32/1529_2.png) [@Pratik\_Poddar](https://discuss.elastic.co/u/Pratik_Poddar)\
**Post date:** [March 18, 2014, 10:25am UTC](https://discuss.elastic.co/t/elastic-search-scoring-query-terms-boost/16420/1 "2014-03-18T10:25:17Z")

</div>

Hey,

Sorry for the noob question. Realy appreciate if someone can help me  
through this. I am using Elastic Search python. I am search a string like  
"Arvind Kejriwal India Today Economic Times" and it gives me reasonable  
results. I was hoping I could increase weight of the first words more in  
the search query. How can I do that?

res = es.search(index="article-index", fields="url", body={"query":  
{"query\_string": {"query": keywordstr, "fields": ["text", "title", "tags",  
"domain"]}}})

I am using the above command to search right now.

> <https://stackoverflow.com/questions/22476315/elastic-search-boost-query-corresponding-to-first-search-term>

--  
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/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Honza\_Kral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/honza_kral/32/876_2.png) [@Honza\_Kral](https://discuss.elastic.co/u/Honza_Kral)\
**Post date:** [March 18, 2014, 2:20pm UTC](https://discuss.elastic.co/t/elastic-search-scoring-query-terms-boost/16420/2 "2014-03-18T14:20:01Z")

</div>

Hi Pratik,

in Lucene query syntax, which is what query\_string uses, supports  
boosting of terms with ^N notation (0), so

"Arvind^6 Kejriwal^6 India Today economic times"

will mark the two first terms as more important.

0 - [Apache Lucene - Query Parser Syntax](http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Boosting%20a%20Term)

Hope this helps,  
Honza

On Tue, Mar 18, 2014 at 11:25 AM, Pratik Poddar [pratik.phodu@gmail.com](mailto:pratik.phodu@gmail.com) wrote:

> Hey,
> 
> Sorry for the noob question. Realy appreciate if someone can help me through  
> this. I am using Elastic Search python. I am search a string like "Arvind  
> Kejriwal India Today Economic Times" and it gives me reasonable results. I  
> was hoping I could increase weight of the first words more in the search  
> query. How can I do that?
> 
> res = es.search(index="article-index", fields="url", body={"query":  
> {"query\_string": {"query": keywordstr, "fields": ["text", "title", "tags",  
> "domain"]}}})
> 
> I am using the above command to search right now.
> 
> [elasticsearch - Elastic Search boost query corresponding to first search term - Stack Overflow](http://stackoverflow.com/questions/22476315/elastic-search-boost-query-corresponding-to-first-search-term)
> 
> --  
> 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/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.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/CABfdDir0XEpCtL3Yt1k7x2U9JG-PHS7H4k6JiuGSdUkR\_2D8tg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CABfdDir0XEpCtL3Yt1k7x2U9JG-PHS7H4k6JiuGSdUkR_2D8tg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pratik\_Poddar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pratik_poddar/32/1529_2.png) [@Pratik\_Poddar](https://discuss.elastic.co/u/Pratik_Poddar)\
**Post date:** [April 5, 2014, 7:40pm UTC](https://discuss.elastic.co/t/elastic-search-scoring-query-terms-boost/16420/3 "2014-04-05T19:40:08Z")

</div>

Thanks. That worked like a charm.

On Tuesday, March 18, 2014 7:50:01 PM UTC+5:30, Honza Král wrote:

> Hi Pratik,
> 
> in Lucene query syntax, which is what query\_string uses, supports  
> boosting of terms with ^N notation (0), so
> 
> "Arvind^6 Kejriwal^6 India Today economic times"
> 
> will mark the two first terms as more important.
> 
> 0 -  
> [Apache Lucene - Query Parser Syntax](http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Boosting%20a%20Term)
> 
> Hope this helps,  
> Honza
> 
> On Tue, Mar 18, 2014 at 11:25 AM, Pratik Poddar \<[pratik...@gmail.com](mailto:pratik...@gmail.com)\<javascript:\>\>  
> wrote:
> 
> > Hey,
> > 
> > Sorry for the noob question. Realy appreciate if someone can help me  
> > through  
> > this. I am using Elastic Search python. I am search a string like  
> > "Arvind  
> > Kejriwal India Today Economic Times" and it gives me reasonable results.  
> > I  
> > was hoping I could increase weight of the first words more in the search  
> > query. How can I do that?
> > 
> > res = es.search(index="article-index", fields="url", body={"query":  
> > {"query\_string": {"query": keywordstr, "fields": ["text", "title",  
> > "tags",  
> > "domain"]}}})
> > 
> > I am using the above command to search right now.
> 
> [elasticsearch - Elastic Search boost query corresponding to first search term - Stack Overflow](http://stackoverflow.com/questions/22476315/elastic-search-boost-query-corresponding-to-first-search-term)
> 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.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/a87303f3-d716-4838-9fca-4709f8d3c18b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a87303f3-d716-4838-9fca-4709f8d3c18b%40googlegroups.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:37am UTC](https://discuss.elastic.co/t/elastic-search-scoring-query-terms-boost/16420/4 "2017-07-06T01:37:58Z")

</div>


