# Elastic search boosting

**URL:** <https://discuss.elastic.co/t/elastic-search-boosting/14317>\
**Category:** Elasticsearch\
**Created:** [November 8, 2013, 6:49am UTC](https://discuss.elastic.co/t/elastic-search-boosting/14317 "2013-11-08T06:49:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pansarivipuljain](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@pansarivipuljain](https://discuss.elastic.co/u/pansarivipuljain)\
**Post date:** [November 8, 2013, 6:49am UTC](https://discuss.elastic.co/t/elastic-search-boosting/14317/1 "2013-11-08T06:49:27Z")

</div>

Hi Guys,

In my elastic search data there is different number of companies with there  
whole address and each companies has specific count on the basis of this we  
define the boosting factor, means max count companies having max score.

my searching query is :

```
    {"from":0,"size":10, "query":{
   "custom_score" : {
     "query" : {
     "match" : {"COMPANY" : {"query" : "*google*", "type" : 

```

"phrase\_prefix", "boost":2}}  
},  
"script" : "\_score/\_score \* doc['COUNT'].value"

```
       }
       }
       }

```

it work fine for me.

now one more thing i want in this. if the user country is canadian then  
canadian companies should be display first with the max count factor and if  
user country is US then US companies should be display first.

Means i want to boost the result on the basis of COUNT and COUNTRY both.

can any one help me on this, what should be the query for this type of  
boosting.

Thanks,  
Vipul

--  
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:08am UTC](https://discuss.elastic.co/t/elastic-search-boosting/14317/2 "2017-07-06T02:08:15Z")

</div>


