# Boosting a non queried field

**URL:** <https://discuss.elastic.co/t/boosting-a-non-queried-field/65601>\
**Category:** Elasticsearch\
**Created:** [November 10, 2016, 8:19am UTC](https://discuss.elastic.co/t/boosting-a-non-queried-field/65601 "2016-11-10T08:19:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ariella](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@ariella](https://discuss.elastic.co/u/ariella)\
**Post date:** [November 10, 2016, 8:19am UTC](https://discuss.elastic.co/t/boosting-a-non-queried-field/65601/1 "2016-11-10T08:19:36Z")

</div>

I want to run a query string query, meaning to query the "\_all" field, but I would like to score higher a document in which the term I searched for was in a specific field.  
For example, i want to search the term "john" over a "person" type (using a query string query because I want everything that's connected to john somehow), but if john appears in the field "name", I want to score it higher than a document in which "john" appears in the field "street".

How can I do that?  
Thanks

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 10, 2016, 8:52pm UTC](https://discuss.elastic.co/t/boosting-a-non-queried-field/65601/2 "2016-11-10T20:52:02Z")

</div>

You can look at the Bool Query : [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)

You can add your must() with John on \_all field and a should() on the field name = John. So that documents with John in the name will have a best score.

---

<div class="post-metadata">

**Author:** ![ariella](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@ariella](https://discuss.elastic.co/u/ariella)\
**Post date:** [November 11, 2016, 5:07pm UTC](https://discuss.elastic.co/t/boosting-a-non-queried-field/65601/3 "2016-11-11T17:07:14Z")

</div>

yeah i thought of that way, i was just wondering if there is another way without adding queries to each boosted field separately.  
thanks anyway!

---

<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:** [December 9, 2016, 5:07pm UTC](https://discuss.elastic.co/t/boosting-a-non-queried-field/65601/4 "2016-12-09T17:07:13Z")

</div>

Closed on December 9, 2016, 5:07pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
