ElasticSearch pagination through pyes. Offset ignored ElasticSearch pagination through pyes. Offset ignored elasticsearch elasticsearch

ElasticSearch pagination through pyes. Offset ignored


The problem was in how the request was sent to ES, although I'm still not clear on why it failed.

Instead of sending the queries directly to ES like I did originally:

r0 = conn.search(q, indexes = ["test-index"], start=0, size=1)r1 = conn.search(q, indexes = ["test-index"], start=1, size=1)r2 = conn.search(q, indexes = ["test-index"], start=2, size=1)

I wrapped my queries in a pyes.query.Search object:

r0 = conn.search(Search(q, start=0, size=1), indexes = ["test-index"])r1 = conn.search(Search(q, start=1, size=1), indexes = ["test-index"])r2 = conn.search(Search(q, start=2, size=1), indexes = ["test-index"])

That worked, see the output below:

0s: [{u'_score': 0.19178301, u'_type': u'test-type', u'_id': u'4', u'_source': {u'position': 4, u'name': u'Last Joe', u'uuid': u'44444'}, u'_index': u'test-index'}]1s: [{u'_score': 0.19178301, u'_type': u'test-type', u'_id': u'1', u'_source': {u'position': 1, u'name': u'Joe Tester', u'uuid': u'11111'}, u'_index': u'test-index'}]2s: [{u'_score': 0.19178301, u'_type': u'test-type', u'_id': u'3', u'_source': {u'position': 3, u'name': u'Joe Joseph', u'uuid': u'33333'}, u'_index': u'test-index'}]