Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch 2.9
Describe the issue:
I’ve encountered an issue with search_after functionality used with sort on nested field.
I have around 40k documents and I want to retrieve them using search_after
I expect that I will eventually have 30k records at the end (after all search_after queries), example search_after query:
{
"query: { some query here },
"search_after": [
123,
"some_id"
],
"sort": [
{
"AAA.bbb": {
"order": "asc",
"unmapped_type": "long",
"nested": {
"path": "AAA"
}
}
},
{
"_id": {
"order": "asc"
}
}
]
}
as a result I have ~11k results.
but for the same query but different sort params (not on nested field) I have proper expected results (30k), example query:
"search_after": [
"some_name",
"some_id"
],
"sort": [
{
"name": {
"order": "desc",
"unmapped_type": "long"
}
},
{
"_id": {
"order": "asc"
}
}
]
Has anyone had a similar issue or have an idea what could be the problem?
Thanks in advance !
Pawel