Pagination: Determine Page Number Of A Record

I have a requirement where a document could be anywhere in a result set and
I need to calculate a page number according where this document is in the
results. I've been trying many different ideas such as using a script to
calculate the page number based on the total count and a counter variable,
but the counter keeps getting reset every time a shard is queried.

I also tried returning the entire result set and calculating this value in
.net, but ES takes too long to complete a query request for sizes of 8000
or more. I realize we shouldn't be returning these many features, but the
scan and scroll is not an option because I will need to parse each response
to see if the document I'm looking for is in it.

From and size also wont work because I have no idea what the 'from' value
will be, and that is the value I'm trying to calculate.

I guess my question is, does any one have an idea of how to calculate a
page number for a given document inside a query result?

Perhaps there is some functionality in ES that will tell you a document
with a certain ID is the n'th document in the entire result set?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3c2458c1-629c-42d8-8a7e-551c6c093cda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.