Complete the code to add the search_after parameter for pagination.
{
"query": { "match_all": {} },
"sort": [ { "timestamp": "asc" } ],
"size": 10,
"search_after": [1]
}The search_after parameter expects an array of sort values from the last hit of the previous page to continue pagination.
Complete the code to sort results by timestamp ascending and tie-break by _id.
{
"sort": [
{ "timestamp": "asc" },
{ [1]: "asc" }
]
}When using search_after, sorting by a unique field like _id as a tie-breaker is recommended.
Fix the error in the search_after value format.
{
"search_after": [1]
}The search_after parameter must be an array of values matching the sort fields, not a string or object.
Fill both blanks to create a search query with search_after and sort by timestamp and _id ascending.
{
"query": { "match_all": {} },
"sort": [
{ [1]: "asc" },
{ [2]: "asc" }
],
"search_after": ["2023-01-01T00:00:00", "abc123"]
}Sorting by timestamp and then by unique _id ascending is required for stable pagination with search_after.
Fill all three blanks to build a search query with match, sort, and search_after for pagination.
{
"query": { "match": { "status": [1] } },
"sort": [
{ [2]: "desc" },
{ [3]: "asc" }
],
"search_after": [1680000000, "xyz789"]
}The query matches documents with status "active". Sorting is by timestamp descending and _id ascending. The search_after array matches these sort fields.