Newbie question: Filter/Matching for different criterias with kind of matching score?


I'm completely new to elasticsearch so sorry for this newbie question.

I read about elasticsearch score calculation for full text search and also about the filter in a query (in a boolean way: 1 if the document matchs the filter 0 if not). So an document is not in the result set if it's not matchs a filter.

But is there a way in elasticsearch to calculate a kind of "matching score" for different filter?

For example:

  • I have a query with 5 different filter-criterias.
  • If a document matchs all 5 criterias it has a score of 1, if a document matchs just 4 criterias it just has a score of 0.8.
  • It would be great to set different weights for these criterias to.

Import for me is that a document should be in the result if it's not matchs all filter-criterias, but to see in the score value which document ranks best to the different filter-criterias.

Hope you understand my thought/requirement.

How can I solve this with elasticsearch? What do I have to read/looking for in elasticsearch (maybe an example)?

Can that be solved with function_score? Or is the solution to set these criterias in query context and not in filter context?

Thanks for any help!

Best regards,


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.