When I execute the following code the error "TypeError: pop expected at most 1 argument, got 2" is occuring, please provide solutions to fix this.
def creatdocs(filename,pdfcontent):
docs = [{
'content': paragraph,
'meta': {
'source': filename
}
}for paragraph in pdfcontent
]
yield docs
#calling the function:
helpers.bulk(es, creatdocs(filename,pdfcontent),index='indexname2')
Error:
Traceback (most recent call last):
File "C:\Python 3.10.7\lib\site-packages\elasticsearch\helpers\actions.py", line 524, in bulk
for ok, item in streaming_bulk(
File "C:\Python 3.10.7\lib\site-packages\elasticsearch\helpers\actions.py", line 422, in streaming_bulk
for bulk_data, bulk_actions in _chunk_actions(
File "C:\Python 3.10.7\lib\site-packages\elasticsearch\helpers\actions.py", line 232, in _chunk_actions
for action, data in actions:
File "C:\Python 3.10.7\lib\site-packages\elasticsearch\helpers\actions.py", line 65, in expand_action
op_type: str = data.pop("_op_type", "index")
TypeError: pop expected at most 1 argument, got 2
Version:
Python 3.10.7
Elasticsearch client 8.5.3
Elasticsearch server 8.5.3