Slicing with None as second argument #170

mindflayer opened this Issue Sep 23, 2013 · 2 comments

2 participants


You implemented pagination of results using the Python slicing syntax.
So, it makes sense asking for documents with the following one:

queryset[5:] # all results except the first five

At the moment the above instruction returns only ten elements (if available) using the default pagination of Elasticsearch, instead of serving all results 'till the end, except the first 5 skipped.


I'm opening an issue as you suggested at #167.

Mozilla member

My comment from pull #167 covers my thoughts on this and possible implementation details:

It sounds like you want to fix the behavior to be more correct in regards to standard Python slicing behavior. That makes sense to me.

However, I don't see a valid use case for why anyone would find themselves in this situation, certainly not with paging.

Regardless, the way you're fixing this causes ElasticUtils to do an additional ES request to get the count. I don't want to do that. If you can figure out a way that doesn't involve hitting ES for the count, then I'm game for looking at that.

Until then, I think we should make add a note about this unintended behavior to the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment