# Boosting a document on a field value irrelevant to the actual search

**URL:** <https://discuss.elastic.co/t/boosting-a-document-on-a-field-value-irrelevant-to-the-actual-search/54957>\
**Category:** Elasticsearch\
**Created:** [July 7, 2016, 3:00pm UTC](https://discuss.elastic.co/t/boosting-a-document-on-a-field-value-irrelevant-to-the-actual-search/54957 "2016-07-07T15:00:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bert\_Vanpeteghem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bert_vanpeteghem/32/96191_2.png) [@Bert\_Vanpeteghem](https://discuss.elastic.co/u/Bert_Vanpeteghem)\
**Post date:** [July 7, 2016, 3:00pm UTC](https://discuss.elastic.co/t/boosting-a-document-on-a-field-value-irrelevant-to-the-actual-search/54957/1 "2016-07-07T15:00:22Z")

</div>

Hi,

For example:  
We have documents of a type "contact". A contact can be internal or external.

When searching for contacts, internal contacts should be ranked higher than external contacts.

What would be the best way to implement this?

Thanks!

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [July 7, 2016, 3:11pm UTC](https://discuss.elastic.co/t/boosting-a-document-on-a-field-value-irrelevant-to-the-actual-search/54957/2 "2016-07-07T15:11:18Z")

</div>

Take a look at the [Function Score Query](https://www.elastic.co/guide/en/elasticsearch/guide/current/function-score-query.html). With the [`script_score`](https://www.elastic.co/guide/en/elasticsearch/guide/current/script-score.html) you have access to the fields in the document and also to the original search score, so it should be possible to boost the internal contacts by a fixed amount.

---

<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 5, 2017, 10:37pm UTC](https://discuss.elastic.co/t/boosting-a-document-on-a-field-value-irrelevant-to-the-actual-search/54957/3 "2017-07-05T22:37:20Z")

</div>


