Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Open Search 2.6
Describe the issue:
I have more than 1 million hits,
So to paginate them to jump from a page to a non-consecutive page, I used search slicing with PIT which has the slice ID and a max value which is maximum slices(pages) My queries are:
To calculate the number of pages, I need to get the total hits captured during the PIT id creation. This total hit count will be helpful for me to decide the max value in search slicing.
Consider the below example I have total of 49,000 hits so with PIT and search slicing , I mentioned the query as below,
REQUEST:
GET /_search
{
“slice”: {
“id”: 4,
“max”: 5
},
“pit”: {
“id”: “w97JyWEFoNzJOWUJGxdHN1QQAWMWN3TVhsby1RdUtHLUx”
}}
RESPONSE:
{
“pit_id”: "w97JyWEFoNzJOWUJGxdHN1QQAWMWN3TVhsby1RdUtHLUx,
“took”: 4,
“timed_out”: false,
“_shards”: {
“total”: 5,
“successful”: 5,
“skipped”: 0,
“failed”: 0
},
“hits”: {
“total”: {
“value”: 9587,
“relation”: “eq”
},
“max_score”: 1,
“hits”: [
{
“_index”: “unitcase-2023.08.09”,
“_id”: “mJqZ3IkBzwDCUDA2eXbl”,
“_score”: 1,
“_source”: {
“@timestamp”: “2023-08-09T23:19:50.794Z”,
“log”: “Reboot failed”
“service_name”: “Hostdb”
}
}
Above response shows value as 9587, but I got only 10 hits do I need to specify the size field in search slicing.
Is PIT with search slicing is the best method to paginate??