Elasticsearch dsl (python) scanerror

I am getting the following error while trying to scroll through results:
Elasticsearch.helpers.ScanError: Scroll request has only succeeded on 13 shards out of 14

The code looks like this:

from elasticsearch_dsl import Search # pip install elasticsearch-dsl
s = Search(using = es, index = <index-name>, doc_type = '_doc').query("match", <field-name>=<name-string>).query("range", **{'@timestamp': {'gte': 'now-30d', 'lt': 'now'}} )
hits = s.scan()
log_list = []
for hit in hits:
    log = vars(hit)['_d_']
    #print( log )        
    log_list.append( log )

I am wondering what might cause this issue. Is there something wrong with the 1 shard, or the server containing the shard? Thought I would ask before digging in too deep in case someone has encountered and solved it already. I found the following question in the forum, but no answer.

This is most likely a bug where we don't take into account shards that have been skipped, those should be counted as successful but the code doesn't reflect that. My apologies for this, I just pushed a fix for this into elasticsearch-py and will do a release soon - https://github.com/elastic/elasticsearch-py/commit/fc78c992ef6ceca157f369186760c8c550fb3bc4

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.