# Helpers.parallel\_bulk in Python not working?

**URL:** <https://discuss.elastic.co/t/helpers-parallel-bulk-in-python-not-working/39498>\
**Category:** Elasticsearch\
**Created:** [January 19, 2016, 3:52am UTC](https://discuss.elastic.co/t/helpers-parallel-bulk-in-python-not-working/39498 "2016-01-19T03:52:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![honzakral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/honzakral/32/44958_2.png) [@honzakral](https://discuss.elastic.co/u/honzakral)\
**Post date:** [January 19, 2016, 4:55pm UTC](https://discuss.elastic.co/t/helpers-parallel-bulk-in-python-not-working/39498/2 "2016-01-19T16:55:34Z")

</div>

Hi,

parallel bulk is a `generator`, meaning it is lazy and won't produce any results until you start consuming them. The proper way to use it is:

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

```

If you don't care about the results (which by default you don't have to since any error will cause an exception) you can use the `consume` function from itertools recipes ([https://docs.python.org/2/library/itertools.html#recipes](https://docs.python.org/2/library/itertools.html#recipes)):

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

```

Hope this helps.

---

_[View the full topic](https://discuss.elastic.co/t/helpers-parallel-bulk-in-python-not-working/39498)._
