Skip to content

Commit accb19a

Browse files
committed
Action must be a dict, not serialized string
1 parent f9f4f0c commit accb19a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

elasticsearch/helpers/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def _chunk_actions(actions, chunk_size, max_chunk_bytes, serializer):
5555
bulk_actions, bulk_data = [], []
5656
size, action_count = 0, 0
5757
for action, data in actions:
58+
raw_action = action
5859
action = serializer.dumps(action)
5960
cur_size = len(action) + 1
6061

@@ -71,9 +72,9 @@ def _chunk_actions(actions, chunk_size, max_chunk_bytes, serializer):
7172
bulk_actions.append(action)
7273
if data is not None:
7374
bulk_actions.append(data)
74-
bulk_data.append((action, data))
75+
bulk_data.append((raw_action, data))
7576
else:
76-
bulk_data.append((action, ))
77+
bulk_data.append((raw_action, ))
7778

7879
size += cur_size
7980
action_count += 1
@@ -237,7 +238,7 @@ def _setup_queues(self):
237238

238239
try:
239240
for result in pool.imap(
240-
lambda bulk_data, bulk_actions: list(_process_bulk_chunk(client, bulk_actions, bulk_data, **kwargs)),
241+
lambda bulk_chunk: list(_process_bulk_chunk(client, bulk_chunk[1], bulk_chunk[0], **kwargs)),
241242
_chunk_actions(actions, chunk_size, max_chunk_bytes, client.transport.serializer)
242243
):
243244
for item in result:

0 commit comments

Comments
 (0)