# Function\_score limit size

**URL:** <https://discuss.elastic.co/t/function-score-limit-size/40090>\
**Category:** Elasticsearch\
**Created:** [January 26, 2016, 6:50am UTC](https://discuss.elastic.co/t/function-score-limit-size/40090 "2016-01-26T06:50:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ycunc](https://avatars.discourse-cdn.com/v4/letter/y/dec6dc/32.png) [@ycunc](https://discuss.elastic.co/u/ycunc)\
**Post date:** [January 26, 2016, 6:50am UTC](https://discuss.elastic.co/t/function-score-limit-size/40090/1 "2016-01-26T06:50:22Z")

</div>

Hello

If I am writing such a ES script to do search

{  
"query": {  
"function\_score" : {  
"boost\_mode": "replace",  
"query": {  
"match": {  
XXXXXX  
}  
},  
"script\_score": {  
"script": "XXXXXXX",  
"lang": "native",  
"params": {  
XXXXXX  
}  
}  
}  
},  
"size": 10  
}

the idea is we will use a native script to rescore the search results returned from the first query. I am wondering is there a way we can limit the size for second stage native script rescoing since rescoring is very expensive. In rescore function, there was a "window\_size" parameter, but it seems there is no such parameter for function\_score. Please advise some feasible approach?

Thanks!

---

<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, 11:21pm UTC](https://discuss.elastic.co/t/function-score-limit-size/40090/2 "2017-07-05T23:21:43Z")

</div>


