Class BoostingQueryBuilder

java.lang.Object
org.elasticsearch.index.query.AbstractQueryBuilder<BoostingQueryBuilder>
org.elasticsearch.index.query.BoostingQueryBuilder
All Implemented Interfaces:
NamedWriteable, Writeable, ToXContent, ToXContentObject, QueryBuilder, Rewriteable<QueryBuilder>

public class BoostingQueryBuilder
extends AbstractQueryBuilder<BoostingQueryBuilder>
The BoostingQuery class can be used to effectively demote results that match a given query. Unlike the "NOT" clause, this still selects documents that contain undesirable terms, but reduces their overall score:

Query balancedQuery = new BoostingQuery(positiveQuery, negativeQuery, 0.01f); In this scenario the positiveQuery contains the mandatory, desirable criteria which is used to select all matching documents, and the negativeQuery contains the undesirable elements which are simply used to lessen the scores. Documents that match the negativeQuery have their score multiplied by the supplied "boost" parameter, so this should be less than 1 to achieve a demoting effect