Struggling with understand how to add boost if a field is true


(Scott Reynolds) #1

I have a set of documents that have a field user_verified that is either
true or false. When executing a disjunction max query I want documents
where the user_verified is true to be given a boost.

I thought the answer was constant_score, but I have really failed to figure
out how to make this work. I am missing something fundmental. Here is the
php code that creates a QueryDSL

I have tried a bunch of combinations and have really failed to figure it
out. Any help would be greatly appreciated.

Thanks,
Scott


(Shay Banon) #2

Maybe custom_filters_score will do the trick?
http://www.elasticsearch.org/guide/reference/query-dsl/custom-filters-score-query.html.
Wrap your query with it, and add a filter on the boolean field, if its
true, you can adjust the score in this case.

On Thu, Mar 22, 2012 at 10:55 PM, Scott Reynolds sdrreynolds@gmail.comwrote:

I have a set of documents that have a field user_verified that is either
true or false. When executing a disjunction max query I want documents
where the user_verified is true to be given a boost.

I thought the answer was constant_score, but I have really failed to
figure out how to make this work. I am missing something fundmental. Here
is the php code that creates a QueryDSL

https://gist.github.com/2164332

I have tried a bunch of combinations and have really failed to figure it
out. Any help would be greatly appreciated.

Thanks,
Scott


(system) #3