# Boosting per field during runtime is not working...please help

**URL:** <https://discuss.elastic.co/t/boosting-per-field-during-runtime-is-not-working-please-help/14556>\
**Category:** Elasticsearch\
**Created:** [November 23, 2013, 3:07am UTC](https://discuss.elastic.co/t/boosting-per-field-during-runtime-is-not-working-please-help/14556 "2013-11-23T03:07:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nirmala\_ranganathan](https://avatars.discourse-cdn.com/v4/letter/n/e99b99/32.png) [@nirmala\_ranganathan](https://discuss.elastic.co/u/nirmala_ranganathan)\
**Post date:** [November 23, 2013, 3:07am UTC](https://discuss.elastic.co/t/boosting-per-field-during-runtime-is-not-working-please-help/14556/1 "2013-11-23T03:07:07Z")

</div>

Here my query:

curl -XGET 'localhost:9200/mongoentityindex/\_search?pretty=true' -d '  
{  
"fields": ["entityData.contact.name",  
"entityData.contact.streetAddress", "entityData.contact.addressLocality",  
"entityData.aliasList"],  
"query": {  
"query\_string": {  
"fields" :  
["entityData.contact.name^20","entityData.contact.streetAddress^10","entityData.contact.addressLocality^8","entityData.aliasList^1"],  
"query": "_North Star_",  
"default\_operator" : "and",  
"analyzer" : "standard",  
"analyze\_wildcard": true,  
"allow\_leading\_wildcard" : true,  
"lowercase\_expanded\_terms" : true,  
"enable\_position\_increments" : true,  
"auto\_generate\_phrase\_queries": true,  
"fuzzy\_prefix\_length" : 0,  
"fuzzy\_min\_sim" : 0.5,  
"phrase\_slop" : 0,  
"boost" : 5.0  
}  
},  
"highlight" : {  
"pre\_tags" : [""],  
"post\_tags" : [""],  
"fields" : {"\_all" : {}}  
},  
"size":10  
}'

Without the fields marked red above in the "query\_string", it returns 10  
results as per the query.  
I would like to query by boosting the fields during run time otherwise the  
results returned is not in the right order.  
Other alternative is to boost during mapping time but I don't want to do  
that because if there is a need to change the boosting in future I need to  
redo the mapping.

Please help.

--  
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:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [November 25, 2013, 9:02am UTC](https://discuss.elastic.co/t/boosting-per-field-during-runtime-is-not-working-please-help/14556/2 "2013-11-25T09:02:37Z")

</div>

Hi,  
not sure I got what the problem is.

If you specify multiple fields on your query you potentially get back more  
results, since you are searching against multiple fields. You can then  
assign weights to those fields in order to tune their importance, as you  
did. Those weights need some fine-tuning though, as the score doesn't only  
depend on them.

On Saturday, November 23, 2013 4:07:07 AM UTC+1, nirmala ranganathan wrote:

> Here my query:
> 
> curl -XGET 'localhost:9200/mongoentityindex/\_search?pretty=true' -d '  
> {  
> "fields": ["entityData.contact.name[http://www.google.com/url?q=http%3A%2F%2FentityData.contact.name&sa=D&sntz=1&usg=AFQjCNHz4krw84PJoNu\_k-R3foIgNRzvrA](http://www.google.com/url?q=http%3A%2F%2FentityData.contact.name&sa=D&sntz=1&usg=AFQjCNHz4krw84PJoNu_k-R3foIgNRzvrA)",  
> "entityData.contact.streetAddress", "entityData.contact.addressLocality",  
> "entityData.aliasList"],  
> "query": {  
> "query\_string": {  
> "fields" : ["entityData.contact.name[http://www.google.com/url?q=http%3A%2F%2FentityData.contact.name&sa=D&sntz=1&usg=AFQjCNHz4krw84PJoNu\_k-R3foIgNRzvrA](http://www.google.com/url?q=http%3A%2F%2FentityData.contact.name&sa=D&sntz=1&usg=AFQjCNHz4krw84PJoNu_k-R3foIgNRzvrA)  
> ^20","entityData.contact.streetAddress^10","entityData.contact.addressLocality^8","entityData.aliasList^1"],  
> "query": "_North Star_",  
> "default\_operator" : "and",  
> "analyzer" : "standard",  
> "analyze\_wildcard": true,  
> "allow\_leading\_wildcard" : true,  
> "lowercase\_expanded\_terms" : true,  
> "enable\_position\_increments" : true,  
> "auto\_generate\_phrase\_queries": true,  
> "fuzzy\_prefix\_length" : 0,  
> "fuzzy\_min\_sim" : 0.5,  
> "phrase\_slop" : 0,  
> "boost" : 5.0  
> }  
> },  
> "highlight" : {  
> "pre\_tags" : [""],  
> "post\_tags" : [""],  
> "fields" : {"\_all" : {}}  
> },  
> "size":10  
> }'
> 
> Without the fields marked red above in the "query\_string", it returns 10  
> results as per the query.  
> I would like to query by boosting the fields during run time otherwise the  
> results returned is not in the right order.  
> Other alternative is to boost during mapping time but I don't want to do  
> that because if there is a need to change the boosting in future I need to  
> redo the mapping.
> 
> Please help.

--  
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:05am UTC](https://discuss.elastic.co/t/boosting-per-field-during-runtime-is-not-working-please-help/14556/3 "2017-07-06T02:05:04Z")

</div>


