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

**URL:** https://discuss.elastic.co/t/newbie-question-filter-matching-for-different-criterias-with-kind-of-matching-score/230876
**Category:** Elasticsearch
**Created:** [May 3, 2020, 1:36pm UTC](https://discuss.elastic.co/t/newbie-question-filter-matching-for-different-criterias-with-kind-of-matching-score/230876 "2020-05-03T13:36:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![iparker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iparker/32/67594_2.png) [@iparker](https://discuss.elastic.co/u/iparker)
#### Post date: [May 3, 2020, 1:36pm UTC](https://discuss.elastic.co/t/newbie-question-filter-matching-for-different-criterias-with-kind-of-matching-score/230876/1 "2020-05-03T13:36:49Z")

</div>

Hello,

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,

Timo

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 31, 2020, 1:36pm UTC](https://discuss.elastic.co/t/newbie-question-filter-matching-for-different-criterias-with-kind-of-matching-score/230876/2 "2020-05-31T13:36:51Z")

</div>

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