Skip to content

The bulk API is not working #674

@nishantkshyp2004

Description

@nishantkshyp2004

The Bulk python API is throwing the error:

es = Elasticsearch()
for line in request.FILES['document'].readlines():
            actions = [
                {
                    # "_op_type",
                    "_index": index_name,
                    "_type": index_type,
                    "_source": {
                        "utterance": line.decode('utf-8'),
                        }
                }]
            data.append(actions)
helpers.bulk(es, data)](url)```

This code is throwing the error:
```File "/home/nishant/Documents/speedops/esearch/api/admin.py", line 28, in save_model
    helpers.bulk(es, data)
  File "/home/nishant/Documents/speedops/venv3/lib/python3.5/site-packages/elasticsearch/helpers/__init__.py", line 188, in bulk
    for ok, item in streaming_bulk(client, actions, **kwargs):
  File "/home/nishant/Documents/speedops/venv3/lib/python3.5/site-packages/elasticsearch/helpers/__init__.py", line 159, in streaming_bulk
    for bulk_actions in _chunk_actions(actions, chunk_size, max_chunk_bytes, client.transport.serializer):
  File "/home/nishant/Documents/speedops/venv3/lib/python3.5/site-packages/elasticsearch/helpers/__init__.py", line 53, in _chunk_actions
    for action, data in actions.__iter__():
  File "/home/nishant/Documents/speedops/venv3/lib/python3.5/site-packages/elasticsearch/helpers/__init__.py", line 33, in expand_action
    op_type = data.pop('_op_type', 'index')
TypeError: pop() takes at most 1 argument (2 given)
[29/Nov/2017 11:38:11] "POST /admin/api/utterance/add/ HTTP/1.1" 500 170328```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions