# Filtering results by score

**URL:** <https://discuss.elastic.co/t/filtering-results-by-score/86336>\
**Category:** Elasticsearch\
**Created:** [May 18, 2017, 9:47pm UTC](https://discuss.elastic.co/t/filtering-results-by-score/86336 "2017-05-18T21:47:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_Amir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaid_amir/32/54679_2.png) [@Zaid\_Amir](https://discuss.elastic.co/u/Zaid_Amir)\
**Post date:** [May 18, 2017, 9:47pm UTC](https://discuss.elastic.co/t/filtering-results-by-score/86336/1 "2017-05-18T21:47:13Z")

</div>

Hi,

I am have a script\_score function that calculates the euclidean distance between a set of points. This is working well and sorting the result by score ascending gets the job done to get the top match with lowest distance.

Now I need to get all the nearest neighbors based on specified threshold, say I want to exclude all points that score a distance of 0.5 and above. I noticed there is a min\_score property but no max\_score.

Is there a way to do this with a search query or should I just keep pulling results until I reach the threshold?

---

<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:** [June 15, 2017, 9:47pm UTC](https://discuss.elastic.co/t/filtering-results-by-score/86336/2 "2017-06-15T21:47:34Z")

</div>

Closed on June 15, 2017, 9:47pm UTC

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