# Post filter results by score and max\_score

**URL:** https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366
**Category:** Elasticsearch
**Created:** [January 14, 2022, 5:37am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366 "2022-01-14T05:37:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![faza.zheten123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/faza.zheten123/32/100319_2.png) [@faza.zheten123](https://discuss.elastic.co/u/faza.zheten123)
#### Post date: [January 14, 2022, 5:37am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/1 "2022-01-14T05:37:21Z")

</div>

Hello,  
I want to show only max scored results. Is it possible? If possible could you tell me how to do it?  
Thanks as lot!

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 14, 2022, 8:47am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/2 "2022-01-14T08:47:25Z")

</div>

Welcome!

You want to only show the document with the best score? Is that it?

In that case, just set `size: 1`  
.  
Or all documents above a given score?

You can use may be this: [Search API | Elasticsearch Guide [7.16] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/search-search.html#search-api-min-score)

But this will require to run a first query with `size: 0` (for optimisation) and extract from the response the `max_score` and run the same query again with `min_score: MAX_SCORE_VALUE`.

HTH

---

<div class="post-metadata">

### Author: ![faza.zheten123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/faza.zheten123/32/100319_2.png) [@faza.zheten123](https://discuss.elastic.co/u/faza.zheten123)
#### Post date: [January 14, 2022, 11:27am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/3 "2022-01-14T11:27:43Z")

</div>

Hi,  
I need all documents where \_score is equal to max\_score.  
Is it possible to do somehow with a single query?

---

<div class="post-metadata">

### Author: ![faza.zheten123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/faza.zheten123/32/100319_2.png) [@faza.zheten123](https://discuss.elastic.co/u/faza.zheten123)
#### Post date: [January 14, 2022, 11:36am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/4 "2022-01-14T11:36:14Z")

</div>

Also, size:0 produces max\_score: null. While size: 1 gives max\_score.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 14, 2022, 11:59am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/5 "2022-01-14T11:59:41Z")

</div>

Ha right!

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 14, 2022, 11:59am UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/6 "2022-01-14T11:59:59Z")

</div>

I don't think so. But unsure.

---

<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: [February 11, 2022, 12:00pm UTC](https://discuss.elastic.co/t/post-filter-results-by-score-and-max-score/294366/7 "2022-02-11T12:00:53Z")

</div>

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