Quantcast

Multiple Boosting Queries in a Bool

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Multiple Boosting Queries in a Bool

Justin Treher
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multiple Boosting Queries in a Bool

Justin Treher
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, [hidden email] 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Loading...