# I need to use search\_after sort by \_score and \_id in a rescore query

**URL:** <https://discuss.elastic.co/t/i-need-to-use-search-after-sort-by-score-and-id-in-a-rescore-query/342789>\
**Category:** Elasticsearch\
**Created:** [September 12, 2023, 8:20am UTC](https://discuss.elastic.co/t/i-need-to-use-search-after-sort-by-score-and-id-in-a-rescore-query/342789 "2023-09-12T08:20:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![George\_Githinji](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/george_githinji/32/124998_2.png) [@George\_Githinji](https://discuss.elastic.co/u/George_Githinji)\
**Post date:** [September 12, 2023, 8:20am UTC](https://discuss.elastic.co/t/i-need-to-use-search-after-sort-by-score-and-id-in-a-rescore-query/342789/1 "2023-09-12T08:20:03Z")

</div>

I want to implement the search\_after pagination technique, I want to sort out the data using \_score and \_id. The problem I am facing is that I have built my query using rescore and you can't use the sort and rescore at the same time if the sort contains an extra field other than the \_score field. My question how is it possible to implement this pagination technique by adding the two sort fields(\_score, \_id) in a rescore query?

---

<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 10, 2023, 8:20am UTC](https://discuss.elastic.co/t/i-need-to-use-search-after-sort-by-score-and-id-in-a-rescore-query/342789/2 "2023-10-10T08:20:20Z")

</div>

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