Search_after doesn't work when sorting descendent

I am implementing a sear_after for cursor pagination, my sort is based on a unique Id that is a text field. When I tried to sort this field desc the search_after doesn't return any result. If I sort asc, it returns results. Can someone help to understand why is this behavior?
this is my query:

GET _index/_search
{
  "size": 20,
  "sort": [
    {
      "hId.keyword": {
        "order": "desc"
      }
    }
  ],
  "search_after": [
    "J18347805"
  ],
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "customer.keyword": {
              "value": "5fgfggg"
            }
          }
        }
      ]
    }
  }
}

I get this as a result

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 92,
    "max_score" : null,
    "hits" : [ ]
  }
}
1 Like

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