# Boosting fields based on type in multi-index searches

**URL:** <https://discuss.elastic.co/t/boosting-fields-based-on-type-in-multi-index-searches/15997>\
**Category:** Elasticsearch\
**Created:** [February 24, 2014, 10:49pm UTC](https://discuss.elastic.co/t/boosting-fields-based-on-type-in-multi-index-searches/15997 "2014-02-24T22:49:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seallison](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@seallison](https://discuss.elastic.co/u/seallison)\
**Post date:** [February 24, 2014, 10:49pm UTC](https://discuss.elastic.co/t/boosting-fields-based-on-type-in-multi-index-searches/15997/1 "2014-02-24T22:49:43Z")

</div>

I have two indices each storing a specific type "Products" and "Stores."  
Some of the attribute names of each type overlap. For instance, both  
Products and Stores have a "name" attribute. How can I search across both  
indices while giving different boost values to the same attribute? I want  
to give Products.name a boost of 1.3 and Stores.name a boost of 1.7. I  
don't see a way to do this with the query string query.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/914d2bd2-84ec-4acc-9064-a66b9f94647d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/914d2bd2-84ec-4acc-9064-a66b9f94647d%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 25, 2014, 12:08am UTC](https://discuss.elastic.co/t/boosting-fields-based-on-type-in-multi-index-searches/15997/2 "2014-02-25T00:08:31Z")

</div>

If I understand you correctly, let's say you have one or more indexes. Then  
you have 2 types named "product" and "store". "product" and "store" both  
have the field "name", but you want to boost the product "name" independent  
from the store "name". You should be able to do something like this:

{  
"query": {  
"query\_string": {  
"query": "blah",  
"fields": [  
"product.name^1.3",  
"store.name^1.7"  
]  
}  
}  
}

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0fd7db3f-c691-4ed2-8251-5897dd93b881%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0fd7db3f-c691-4ed2-8251-5897dd93b881%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![seallison](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@seallison](https://discuss.elastic.co/u/seallison)\
**Post date:** [February 25, 2014, 2:04am UTC](https://discuss.elastic.co/t/boosting-fields-based-on-type-in-multi-index-searches/15997/3 "2014-02-25T02:04:11Z")

</div>

That works perfectly, Thanks! I had no idea you could preface the field  
paths with the type for boosting like that.

On Monday, February 24, 2014 7:08:31 PM UTC-5, Binh Ly wrote:

> If I understand you correctly, let's say you have one or more indexes.  
> Then you have 2 types named "product" and "store". "product" and "store"  
> both have the field "name", but you want to boost the product "name"  
> independent from the store "name". You should be able to do something like  
> this:
> 
> {  
> "query": {  
> "query\_string": {  
> "query": "blah",  
> "fields": [  
> "product.name^1.3",  
> "store.name^1.7"  
> ]  
> }  
> }  
> }

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b5860adf-2f96-430a-9b08-1f7064de29bb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b5860adf-2f96-430a-9b08-1f7064de29bb%40googlegroups.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, 1:47am UTC](https://discuss.elastic.co/t/boosting-fields-based-on-type-in-multi-index-searches/15997/4 "2017-07-06T01:47:37Z")

</div>


