# Clarify behavior of FunctionScoreQuery when there are more than \`size\` matches to the \`query\`

**URL:** <https://discuss.elastic.co/t/clarify-behavior-of-functionscorequery-when-there-are-more-than-size-matches-to-the-query/283596>\
**Category:** Elasticsearch\
**Created:** [September 8, 2021, 2:25am UTC](https://discuss.elastic.co/t/clarify-behavior-of-functionscorequery-when-there-are-more-than-size-matches-to-the-query/283596 "2021-09-08T02:25:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexklibisz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexklibisz/32/31266_2.png) [@alexklibisz](https://discuss.elastic.co/u/alexklibisz)\
**Post date:** [September 8, 2021, 2:25am UTC](https://discuss.elastic.co/t/clarify-behavior-of-functionscorequery-when-there-are-more-than-size-matches-to-the-query/283596/1 "2021-09-08T02:25:21Z")

</div>

I'm running into an issue with the FunctionScoreQuery and would appreciate some clarification of the query behavior.

Say I'm running a `function_score` query with size=100. The actual `query` matches 101 documents. How many times will the function be applied?  
(a) 100 times, i.e. only on the first `size=100` matches  
(b) 101 times, i.e. on all matches

I've observed behavior that suggests the answer is (a).

If so, is there any way to configure the query to actually do (b), i.e., execute the function on all of the matches.

Thanks,  
Alex

---

<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:** [October 6, 2021, 2:26am UTC](https://discuss.elastic.co/t/clarify-behavior-of-functionscorequery-when-there-are-more-than-size-matches-to-the-query/283596/2 "2021-10-06T02:26:05Z")

</div>

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