Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ document is like ``{"word": "<myword>"}``.
For a more complete and complex example please take a look at
https://github.com/elastic/elasticsearch-py/blob/master/example/load.py#L76-L130

The :meth:`~elasticsearch.Elasticsearch.parallel_bulk` api is a wrapper around the :meth:`~elasticsearch.Elasticsearch.bulk` api to provide threading. :meth:`~elasticsearch.Elasticsearch.parallel_bulk` returns a generator which must be consumed to produce results.

To see the results use:

.. code:: python

for success, info in parallel_bulk(...):
if not success:
print('A document failed:', info)

If you don't care about the results, you can use deque from collections:

.. code:: python

from collections import deque
deque(parallel_bulk(...), maxlen=0)

.. note::

When reading raw json strings from a file, you can also pass them in
Expand Down