Collapse not working with search_after with single sort field and PIT

I have an Elastic query that initially returns results. When I attempt the query again using search_after for paging, I am getting the error: Cannot use [collapse] in conjunction with [search_after] unless the search is sorted on the same field. Multiple sort fields are not allowed. So far as I can tell, I am sorting and collapsing using just a single field per_id. Is my query structured incorrectly or is there something else I need to do to get this query to run?

GET /_search
{
    "query": {
        "bool": {
            "must": [{
                "term": {
                    "pform": "iphone"
                }
            }]
        }
    },
    "collapse": {
        "field": "per_id"
    },
    "pit": {
        "id": "g-ABCDDEFG12345678ABCDDEFG12345678==",
        "keep_alive": "5m"
    },
    "sort": [ 
      {"per_id": "asc"}
    ],
    "search_after" : [
      "ABCDDEFG12345678",
      123456
    ]
}

Passing the sort provided when using a PIT includes a tiebreaker which is more than one field. I needed to programmatically remove the tiebreakers from my search_after sort to get search_after to work with collapse.
So the sort I was provided was:

    "sort" : [
      "ABCDDEFG12345678",
      123456
    ]

So I would use

    "search_after" : [
      "ABCDDEFG12345678"
    ]

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