# Best practice to paginate full text search queries

**URL:** <https://discuss.elastic.co/t/best-practice-to-paginate-full-text-search-queries/143213>\
**Category:** Elasticsearch\
**Created:** [August 6, 2018, 7:48pm UTC](https://discuss.elastic.co/t/best-practice-to-paginate-full-text-search-queries/143213 "2018-08-06T19:48:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![porunov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/porunov/32/32268_2.png) [@porunov](https://discuss.elastic.co/u/porunov)\
**Post date:** [August 6, 2018, 7:48pm UTC](https://discuss.elastic.co/t/best-practice-to-paginate-full-text-search-queries/143213/1 "2018-08-06T19:48:18Z")

</div>

Hello,

I would like to know what are best practices (what to use) for full text search pagination. I.e. sorting by relevance.  
As I understand it is impossible to use `search_after` parameter to paginate results based on relevance (or am I wrong?).  
If so, how is it better to paginate such queries? Scroll API? Offset parameter? Another technique?  
Any advice is appreciated.

Best regards,  
Alexandr

---

<div class="post-metadata">

**Author:** ![porunov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/porunov/32/32268_2.png) [@porunov](https://discuss.elastic.co/u/porunov)\
**Post date:** [August 7, 2018, 3:42pm UTC](https://discuss.elastic.co/t/best-practice-to-paginate-full-text-search-queries/143213/2 "2018-08-07T15:42:35Z")

</div>

I was wrong. It is possible to sort results by `_score` and then use it in `search_after`.  
I solved my issue by using something like this:

```auto
    "sort":[
    	{"_score": "asc"},
    	{"_uid": "asc"}
    ],
    "search_after": [1.2289224, "type1#KYb9FGUBhsARc5Y5st_n"]

```

---

<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:** [September 4, 2018, 3:42pm UTC](https://discuss.elastic.co/t/best-practice-to-paginate-full-text-search-queries/143213/3 "2018-09-04T15:42:45Z")

</div>

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