# How to use the search after after getting the result using the geolocation sort

**URL:** <https://discuss.elastic.co/t/how-to-use-the-search-after-after-getting-the-result-using-the-geolocation-sort/266359>\
**Category:** Elasticsearch\
**Created:** [March 5, 2021, 11:41am UTC](https://discuss.elastic.co/t/how-to-use-the-search-after-after-getting-the-result-using-the-geolocation-sort/266359 "2021-03-05T11:41:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kushal\_sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kushal_sharma/32/85047_2.png) [@kushal\_sharma](https://discuss.elastic.co/u/kushal_sharma)\
**Post date:** [March 5, 2021, 11:41am UTC](https://discuss.elastic.co/t/how-to-use-the-search-after-after-getting-the-result-using-the-geolocation-sort/266359/1 "2021-03-05T11:41:07Z")

</div>

Hi,  
I have an index in which I have a point field that holds the geolocation of the place, and I have a user interface on the frontend where the user can move the map and he will get the top 10 nearest location, everything is ok till now.

But the problem is that when the user scrolls down and reaches the end of the page, I need to fetch the next 10 nearest locations. How can I achieve this feature?

how to use the search\_after for this one scenario

my query is :

```auto
{
  "size": 10,
  "query": {
    "terms": {
      "type": [
        "hotel",
        "restaurent"
      ]
    }
  },
  "sort": [
    {
      "_geo_distance": {
        "points": {
          "lat": latpoint,
          "lon": lonpoint
        },
        "order": "asc",
        "unit": "km",
        "mode": "min",
        "distance_type": "arc",
        "ignore_unmapped": true
      }
    }
  ]
}

```

---

<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:** [April 2, 2021, 11:41am UTC](https://discuss.elastic.co/t/how-to-use-the-search-after-after-getting-the-result-using-the-geolocation-sort/266359/2 "2021-04-02T11:41:41Z")

</div>

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