Boosting queries by type


(James Wilson) #1

Suppose I am searching using a text query (or query_string, field,
etc.) and would like to boost any results where a document field has a
specific value (in particular, _type). How can I express this in the
query DSL?


(Shay Banon) #2

I gisted two options that you can use, one using bool query (with should
clauses), and one using custom_filters_score (preferable):

On Tue, Oct 18, 2011 at 8:23 PM, James Wilson jwilson556@gmail.com wrote:

Suppose I am searching using a text query (or query_string, field,
etc.) and would like to boost any results where a document field has a
specific value (in particular, _type). How can I express this in the
query DSL?


(James Wilson) #3

Awesome, thank you.

On Oct 18, 2:27 pm, Shay Banon kim...@gmail.com wrote:

I gisted two options that you can use, one using bool query (with should
clauses), and one using custom_filters_score (preferable):https://gist.github.com/1296774

On Tue, Oct 18, 2011 at 8:23 PM, James Wilson jwilson...@gmail.com wrote:

Suppose I am searching using a text query (or query_string, field,
etc.) and would like to boost any results where a document field has a
specific value (in particular, _type). How can I express this in the
query DSL?


(Karussell) #4

preferable in terms of performance?

On 18 Okt., 23:27, Shay Banon kim...@gmail.com wrote:

I gisted two options that you can use, one using bool query (with should
clauses), and one using custom_filters_score (preferable):https://gist.github.com/1296774

On Tue, Oct 18, 2011 at 8:23 PM, James Wilson jwilson...@gmail.com wrote:

Suppose I am searching using a text query (or query_string, field,
etc.) and would like to boost any results where a document field has a
specific value (in particular, _type). How can I express this in the
query DSL?


(Shay Banon) #5

Yes.

On Wed, Oct 19, 2011 at 10:24 PM, Karussell tableyourtime@googlemail.comwrote:

preferable in terms of performance?

On 18 Okt., 23:27, Shay Banon kim...@gmail.com wrote:

I gisted two options that you can use, one using bool query (with should
clauses), and one using custom_filters_score (preferable):
https://gist.github.com/1296774

On Tue, Oct 18, 2011 at 8:23 PM, James Wilson jwilson...@gmail.com
wrote:

Suppose I am searching using a text query (or query_string, field,
etc.) and would like to boost any results where a document field has a
specific value (in particular, _type). How can I express this in the
query DSL?


(system) #6