-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Email/Query Pagination 1 - handle pagination with negative position #3732
Comments
Not exactly. If the position is positive and superior to the number of elements, return 0 result.
So if the value is negative and the absolute value is superior to the number of elements, then you have to return from position 0. |
This seems hard to be implemented with ElasticSearch.... What's the implementation strategy? (Fetch all results then applying the negative offset seems like a non-effiocient way of doing this.) |
I think it gets close to the "total" discussion. If you have the total, a negative position is just |
BTW you would execute the same query two time: one time for getting the total, then the actual negative-turned-to-ppositive search. Sounds costly... We had a call with @remk to discuss that very issue. When a sort is specified, a cheaper alternative is to negate the sort then apply the limit (the result will be the same, but only "limit" items are going to be fetched. This turns the negative position as syntactic sugar for clients. Rejecting negative position when no sort is specified could be wise, as it can bring the ES cluster to its knees, IMO. |
rejection of negative position handled here : #3796 |
WHY
As a client I want to be able to get a long list of results in several operations.
As a client i want to be able to start fetching the result only since a given negative index, to start fetching the result from the end of the list.
It allows to get the last elements without knowing the total number of elements.
On this ticket we will only consider negative position.
HOW
DOD
write an integration test demonstrating that when the client provide a negative position parameter, only the result since the total number of elements minus this position are returned in the response.
write an integration test demonstrating that if the client provide a position parameter with an absolute value bigger than the total number of results then the response is empty and there is no error.
run the tests against the distributed version of the contract
The text was updated successfully, but these errors were encountered: