0

Elastic search disallows negative boost values with v7. Is there a way to reproduce the same behaviour in the new version v7 as it worked in v6 or lower?

I.e. if I had a should query with various multi_match queries (or other) and one or more of them previously had a negative boost, it ment in v6, that when the score of the bool query was summed, it reduced the overall score, of the should query.

The docs and migration notes states, that a score between 0 and 1 should be used instead. But as the should query will always be summed (not multiplied) it will not have the same effect.

Example: (factors = boost values)

(score1 * 1.5)+ (score2 * 2) + (score3 * - 2.3) + (score4 * -1)

How could I get the same result in ES7?

ju_
  • 569
  • 1
  • 4
  • 17

1 Answers1

0

You can use the boosting query to demote certain documents without excluding them from the search results. I hope this will help you. you can refer this article for practicle example.

Sagar Patel
  • 4,993
  • 1
  • 8
  • 19
  • This is not what I want, as the docs say this boosting query works as follows: > Take the original relevance score from the positive query. Then multiply the score by the negative_boost value.` How could I solve the describe problem with this method? Maybe partially, but what if previously I had something like this: (score*1.5)+ (score*2) + (score3*-2.3) + (score4 * -1) how could I get the same result? – ju_ Jan 19 '22 at 14:23
  • As i know this is only way for negative boosting in 7.x version of ES. can you try with your data set and check how relevancy is changing. – Sagar Patel Jan 20 '22 at 05:55
  • I dont think that there is a way to get the same behaviour. Maybe for one negative score, but not for several which should have a different impact on the overall relevance, because only one negative_boost value can be defined if the whole negative query matches. I could not find any other way either, so I came up with the question in the first place. Thanks for your effort. – ju_ Jan 20 '22 at 08:08