# Boosting fields

**URL:** <https://discuss.elastic.co/t/boosting-fields/13857>\
**Category:** Elasticsearch\
**Created:** [October 5, 2013, 6:53pm UTC](https://discuss.elastic.co/t/boosting-fields/13857 "2013-10-05T18:53:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![benmccann](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benmccann/32/420_2.png) [@benmccann](https://discuss.elastic.co/u/benmccann)\
**Post date:** [October 5, 2013, 6:53pm UTC](https://discuss.elastic.co/t/boosting-fields/13857/1 "2013-10-05T18:53:29Z")

</div>

I want to query on numerous fields and have some fields be weighted much  
more heavily than other fields. Only one field needs to match to return a  
result, but if multiple match I'd like the scores to combine to a higher  
score. Another thing that would be nice would be to potentially use one  
field to contribute to scoring, but not retrieval.

It looks like I might be able to use either a bool should query or a  
function\_score query? Any tips on what the best query is to use for the  
case above and what the tradeoffs might be?

Thanks,  
Ben

--  
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:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 5, 2013, 7:07pm UTC](https://discuss.elastic.co/t/boosting-fields/13857/2 "2013-10-05T19:07:05Z")

</div>

Did you read  
[http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/](http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/) ?

With function score query, you are on the right track (it supersedes custom  
filters score query used in the blog post)

Jörg

--  
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:** ![Ben\_McCann\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_mccann_2/32/1097_2.png) [@Ben\_McCann\_2](https://discuss.elastic.co/u/Ben_McCann_2)\
**Post date:** [October 5, 2013, 7:22pm UTC](https://discuss.elastic.co/t/boosting-fields/13857/3 "2013-10-05T19:22:16Z")

</div>

Thanks for the pointer Jörg. That's a great article. I have a question  
after reading it.

When I look at the docs for  
function\_score[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html)it  
shows the following:

"function\_score": {  
"(query|filter)": {},  
"boost": "boost for the whole query",  
"FUNCTION": {},  
"boost\_mode":"(mult|replace|...)"  
}

What's the difference between using query and filter? Is it that a query is  
essential an "or" operation and a filter is an "and" operation?

Thanks,  
Ben

On Sat, Oct 5, 2013 at 12:07 PM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
[joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:

> Did you read  
> [http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/](http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/) ?
> 
> With function score query, you are on the right track (it supersedes  
> custom filters score query used in the blog post)
> 
> Jörg
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/CLDSVrdE-Qk/unsubscribe](https://groups.google.com/d/topic/elasticsearch/CLDSVrdE-Qk/unsubscribe).  
> To unsubscribe from this group and all its topics, 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).

--

> **[Ben McCann on about.me](https://about.me/benmccann)**
>
> I am a Founder, Entrepreneur, and Investor in Mountain View, California. Visit my website.

--  
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:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 5, 2013, 7:34pm UTC](https://discuss.elastic.co/t/boosting-fields/13857/4 "2013-10-05T19:34:39Z")

</div>

Usually you use "query" to compute new scores for the hits in the query.

With "filter" you compute new scores for the hits that are in the filter.

This inherits from "custom score query" and "custom filters score query".

Jörg

--  
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:13am UTC](https://discuss.elastic.co/t/boosting-fields/13857/5 "2017-07-06T02:13:35Z")

</div>


