Boosting query


(Vinicius Carvalho) #1

ES Version: 0.19.8

I'm building a query using boosting query as
follows: https://gist.github.com/3124567

But it seems that boosting is not even being take into account. When I add
explain=true the boosting part not even shows, and regardless if I use a
terms or a plain term like term {"name" : "Karaoke"} the results are always
the same as a plain query string using q=Someone like you.

Am I missing something here?


(Vinicius Carvalho) #2

My bad, oops, should have used "query_string" instead of "terms" on the
boosting :slight_smile:

On Monday, July 16, 2012 3:42:53 PM UTC-4, Vinicius Carvalho wrote:

ES Version: 0.19.8

I'm building a query using boosting query as follows:
https://gist.github.com/3124567

But it seems that boosting is not even being take into account. When I add
explain=true the boosting part not even shows, and regardless if I use a
terms or a plain term like term {"name" : "Karaoke"} the results are always
the same as a plain query string using q=Someone like you.

Am I missing something here?


(Clinton Gormley) #3

I'm building a query using boosting query as
follows: https://gist.github.com/3124567

But it seems that boosting is not even being take into account. When I
add explain=true the boosting part not even shows, and regardless if I
use a terms or a plain term like term {"name" : "Karaoke"} the results
are always the same as a plain query string using q=Someone like you.

I'm guessing that your 'name' field is mapped as { type: "string" },
which means that it is being analyzed. So while its value may be
"Karaoke", the term that is stored is "karaoke".

A term query looks for the exact value. So a term query for "Karaoke"
would not find anything.

Try using a "text" query instead of a "term" query

clint


(Vinicius Carvalho) #4

Thanks. Using query_string did the trick :slight_smile:

On Tuesday, July 17, 2012 4:37:29 AM UTC-4, Clinton Gormley wrote:

I'm building a query using boosting query as
follows: https://gist.github.com/3124567

But it seems that boosting is not even being take into account. When I
add explain=true the boosting part not even shows, and regardless if I
use a terms or a plain term like term {"name" : "Karaoke"} the results
are always the same as a plain query string using q=Someone like you.

I'm guessing that your 'name' field is mapped as { type: "string" },
which means that it is being analyzed. So while its value may be
"Karaoke", the term that is stored is "karaoke".

A term query looks for the exact value. So a term query for "Karaoke"
would not find anything.

Try using a "text" query instead of a "term" query

clint


(system) #5