Retriving last record

I don’t know values of last record. And i want to retrive it. How can I‌ retrive it via opensearchpy?

What does the last record mean? You mean the oldest document order by time? If you just want to get the newest or oldest document, set the parameter size to 1 when executing the query with specified sorting, something like this:

GET index/_search
{
   "size":1,
   "sort":{...}
}