# Multiple Boosting Queries in a Bool

**URL:** <https://discuss.elastic.co/t/multiple-boosting-queries-in-a-bool/10908>\
**Category:** Elasticsearch\
**Created:** [February 26, 2013, 4:08pm UTC](https://discuss.elastic.co/t/multiple-boosting-queries-in-a-bool/10908 "2013-02-26T16:08:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Treher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_treher/32/45243_2.png) [@Justin\_Treher](https://discuss.elastic.co/u/Justin_Treher)\
**Post date:** [February 26, 2013, 4:08pm UTC](https://discuss.elastic.co/t/multiple-boosting-queries-in-a-bool/10908/1 "2013-02-26T16:08:41Z")

</div>

I'm obviously violating something behind the scenes, but I have this really  
awesome query coming together with one hangup.

I'm using a bool, with a query string, a range, and a boosting query.  
Fantastic results. HOwever, I need to add a secondary boosting query on a  
different field. Multiple term queries work fine, but the second boosted  
query throws parsing errors. Is this possible or do I need some creative  
workaround?

If I just copy and paste the boosting section with a different field,as you  
would with a term query, the query fails. I tried getting creative with an  
array and a subquery wrapper, but nothing seems to work. ES head just drops  
one.  
{  
"query": {  
"bool": {  
"should": {  
"boosting": {  
"positive": {  
"term": {  
"demote": "0"  
}  
},  
"negative": {  
"term": {  
"demote": "1"  
}  
},  
"negative\_boost": 1.5  
}  
}  
}  
}  
}

--  
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:** ![Justin\_Treher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_treher/32/45243_2.png) [@Justin\_Treher](https://discuss.elastic.co/u/Justin_Treher)\
**Post date:** [February 26, 2013, 4:49pm UTC](https://discuss.elastic.co/t/multiple-boosting-queries-in-a-bool/10908/2 "2013-02-26T16:49:14Z")

</div>

Nevermind, I'm an idiot. I had made my query way too complex. It does work  
in the array.

On Tuesday, February 26, 2013 11:08:41 AM UTC-5, [jtr...@gmail.com](mailto:jtr...@gmail.com) wrote:

> I'm obviously violating something behind the scenes, but I have this  
> really awesome query coming together with one hangup.
> 
> I'm using a bool, with a query string, a range, and a boosting query.  
> Fantastic results. HOwever, I need to add a secondary boosting query on a  
> different field. Multiple term queries work fine, but the second boosted  
> query throws parsing errors. Is this possible or do I need some creative  
> workaround?
> 
> If I just copy and paste the boosting section with a different field,as  
> you would with a term query, the query fails. I tried getting creative with  
> an array and a subquery wrapper, but nothing seems to work. ES head just  
> drops one.  
> {  
> "query": {  
> "bool": {  
> "should": {  
> "boosting": {  
> "positive": {  
> "term": {  
> "demote": "0"  
> }  
> },  
> "negative": {  
> "term": {  
> "demote": "1"  
> }  
> },  
> "negative\_boost": 1.5  
> }  
> }  
> }  
> }  
> }

--  
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:49am UTC](https://discuss.elastic.co/t/multiple-boosting-queries-in-a-bool/10908/3 "2017-07-06T02:49:24Z")

</div>


