# Wired change of the amount of results by usage of min\_score

**URL:** <https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038>\
**Category:** Elasticsearch\
**Created:** [June 16, 2016, 6:13pm UTC](https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038 "2016-06-16T18:13:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnikolay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nnikolay/32/73361_2.png) [@nnikolay](https://discuss.elastic.co/u/nnikolay)\
**Post date:** [June 16, 2016, 6:13pm UTC](https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038/1 "2016-06-16T18:13:33Z")

</div>

Hi guys!

I am using a query like this:

Select all results for Keyword "X" with min\_score = 0.25. Also I am doing aggregations for this results. But when I am clicking on an aggregation, the number of documents becomes different, because the min\_score. When I remove the min\_score, everything is fine.

Here an example:

For keyword "X" I have 10 results, all with \_score \>= 0,25 and for example one result with score 0,249999, which is not displayed in the results.

Now when I click on a filter the result with the score 0,249999 becomes the score 0,2512345 and is displayed in the result.

The problem is my aggregation has num elements (10), but I am displaying on the site all results (11) . This is wired for the user.  
How can I solve my problem so the number elements are still 10 after clicking on the aggregation?

Many thanks  
Nik

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 17, 2016, 7:10am UTC](https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038/2 "2016-06-17T07:10:27Z")

</div>

Hey,

the problem here is, that each search you execute hits different shards (primary or replicas of a specific one) and those may have slight differences in the scoring. A couple of solutions here

- Change the preference to a custom value so that users hit the same shards with each query, for example use the session ID, see [preference docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html)
- Try `dfs_query_then_fetch` as [search type](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-search-type.html)
- Have a single shard (might not work in production, but is good for testing)

See if one of these yields the expected results.

--Alex

---

<div class="post-metadata">

**Author:** ![nnikolay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nnikolay/32/73361_2.png) [@nnikolay](https://discuss.elastic.co/u/nnikolay)\
**Post date:** [June 17, 2016, 10:03am UTC](https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038/3 "2016-06-17T10:03:37Z")

</div>

Hey Alex,

thanks for the answer. I have trying both suggestions, but the problem comes not from the different shards, the problem comes from the min\_scrore = 0.25 setting.

Here the example again: I am searching for a Shoe "Nike" for example. And I have 2 results

1 result with score 0,25123456 and color red  
2 result with score 0,24999999 and color red

The aggregation on colors is counting 1 and the display result is 1 because the min\_score setting is 0.25.

When I klick on the aggregation and search for "Nike" AND color "RED", then the score of the second result is increasing to 0,253232323 and will displayed in the resultset, BUT the aggregation for color tells me, there were only one result. And this is wired now, because for the user this is a BUG.

Any suggestions how to fix this?

Thanks  
Nik

---

<div class="post-metadata">

**Author:** ![nnikolay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nnikolay/32/73361_2.png) [@nnikolay](https://discuss.elastic.co/u/nnikolay)\
**Post date:** [June 17, 2016, 11:04am UTC](https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038/4 "2016-06-17T11:04:09Z")

</div>

Hi!

I think I found the solution. I am testing now, but it is logically the best one.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html)

I am using must for each filter to the main query and thats why the score has been recalculated. When I change it to filter, then the score is the same for each result in the resultset.

Thanks  
Nik

---

<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:** [July 5, 2017, 10:42pm UTC](https://discuss.elastic.co/t/wired-change-of-the-amount-of-results-by-usage-of-min-score/53038/5 "2017-07-05T22:42:46Z")

</div>


