Helpers.scan throws a key error on ES python package 7.1 but not on 7.0.0

I have a pipeline in production that ingests some data into an elasticsearch index. Recently we upgraded from version 5.4 to 7.4. We also upgraded the python package to v. 7.1.

Now, elasticsearch.helpers.scan command throws an error on elasticsearch package v. 7.1 and above but not on v. 7.0.0. The error is complaining about this line in the package:

if (resp["_shards"]["successful"] + resp["_shards"]["skipped"]) < resp["_shards"]["total"]

KeyError: 'skipped'

After downgrading to 7.0 the code is running fine. But I'm still puzzled about why the error is occuring and what's a long term solution short of downgrading the package and keeping it at version 7.0.0

1 Like