Jeffrey Guenther
Jeffrey Guenther

Reputation: 901

How do I write a query with a negative boost?

The ElasticSearch API indicates that you can create negative boosts to demote results. How does one do this in Searchkick? Do I need to use the advanced query tools? Or is there an option somewhere I'm missing?

Upvotes: 1

Views: 1605

Answers (2)

Jeffrey Guenther
Jeffrey Guenther

Reputation: 901

It's worth noting that function_weight takes a float, so you can using a negative floating point number for a negative boost.

This means that you can use boost_where with a negative value to demote a result based on a field.

Upvotes: 1

Andrew Kane
Andrew Kane

Reputation: 3236

Searchkick doesn't have an option for negative boosts, so you'll need to use advanced querying. I'm happy to accept a pull request for it though.

Upvotes: 0

Related Questions