Loading

Helpers.parallel_bulk in Python not working?

Helpers.parallel_bulk in Python not working?

学习了:https://discuss.elastic.co/t/helpers-parallel-bulk-in-python-not-working/39498

需要写:

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:

parallel_bulk是惰性的;

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

 不这样写真报错呀;

而且必须进行if判断,要不然会输出很多内容;

直接写 a,b = parallel_bulk(...)  if not a  print(b) 会报一个too many value to unpack 错误;

 

posted @ 2018-06-13 17:06  stono  阅读(375)  评论(0编辑  收藏  举报