How to combine Function Score Query and Bool Query?


(Harish Ramanathan) #1

I have a use case where I need to write a search query with Bool Query and Function Score Query.
The Bool Query is having multiple should clauses for Fields with a minimum should match set to 1.
The Function Score Query is set with a Script Function that boosts the score higher if a particular field has a higher value (Integer).

The Bool Query works separately. But, when the Function Score Query is also added in another Should clause, the Results returned are not as expected. The Results that were retrieved earlier with the Bool Query are lost and the Function Score Query also doesn't rank the results properly.

Can a Bool Query and Function Score Query work in a combined fashion? If so, what do you think I am missing here?


(Rachit Puri) #2

Hi,

Where you able to find the work around for the same


(system) #3