# Function\_score limt size

**URL:** <https://discuss.elastic.co/t/function-score-limt-size/159715>\
**Category:** Elasticsearch\
**Created:** [December 6, 2018, 11:00am UTC](https://discuss.elastic.co/t/function-score-limt-size/159715 "2018-12-06T11:00:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmberNew](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ambernew/32/38543_2.png) [@AmberNew](https://discuss.elastic.co/u/AmberNew)\
**Post date:** [December 6, 2018, 11:00am UTC](https://discuss.elastic.co/t/function-score-limt-size/159715/1 "2018-12-06T11:00:02Z")

</div>

{  
"query": {  
"function\_score" : {  
"query": {  
"match": {  
"title":"elasticsearch"  
}  
},  
"script\_score": {  
"script":{  
"inline": "javapulgin",  
"lang": "native",  
}  
}  
},  
"size": 10  
}

the idea is we will use script plugin to rescore the search results returned from the first query. I am wondering is there a way we can limit the size for first query. for example.i can hit 2000 results by query"elasticsearch", but i want to fetch top 1000 order by score. and just rescore top1000 by script plugin.Please advise some feasible approach?  
thanks.

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [December 14, 2018, 9:40am UTC](https://discuss.elastic.co/t/function-score-limt-size/159715/2 "2018-12-14T09:40:12Z")

</div>

did you look into the [rescorer](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-rescore.html#_query_rescorer) and the `windows_size` parameter?

---

<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:** [January 11, 2019, 9:40am UTC](https://discuss.elastic.co/t/function-score-limt-size/159715/3 "2019-01-11T09:40:15Z")

</div>

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