As per the docs, it's seems dynamic boosting is not supported with the elasticsearch implementation:
Quote:
The org.hibernate.search.annotations.DynamicBoost annotation is not (and cannot be) supported with Elasticsearch, because the platform lacks per-document, index-time boosting capabilities. Static boosts (@Boost) are, however, supported.
I'm not currently using elasticsearch, however I am planning to migrate to it shortly. However, without any alternative solution to dynamic boosting, this might be difficult. My scenario is that I have a boolean variable, that when true should provide a boost to the entity. Specifically, the boolean variable represents whether a product is featured or not, and featured products should place higher in search results.
Is there a way to achieve this without using a Dynamic Boost? Maybe at search time?
edit:
If I used a should query, will that have the same effect? eg
Code:
qb.bool()
.must( qb.keyword().onField("productName").matching(searchTerm).createQuery() )
.should( qb.keyword().onField("featured").matching(true).createQuery() )
.createQuery();
edit2:
similarly, I have a dynamic boost based on the popularity of a product, eg the more views, likes, reviews etc a product has, the higher it should rank. How would I achieve this at query time? Is there any way to apply a boost based on the value of a field?