pyelasticsearch bulk ValueError:太多值无法解包(预期2)

fik*_*fok 5 python elasticsearch pyelasticsearch

我是Python和Elasticsearch的新手。我正在尝试编写代码以使用批量在Elassticsearch中插入文档。它基于以下描述:http : //pyelasticsearch.readthedocs.io/en/latest/api/#pyelasticsearch.ElasticSearch.bulk

我的代码:

>>> from pyelasticsearch import ElasticSearch
>>> es = ElasticSearch()
>>> es.bulk([es.index_op(doc={'id': 1, 'color': 'red'}), es.index_op(doc={'id': 2, 'color': 'green'})], doc_type='test10', index='test10')
Run Code Online (Sandbox Code Playgroud)

Python返回此错误消息:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/fikfok/test_env/lib/python3.5/site-packages/pyelasticsearch/client.py", line 93, in decorate
    return func(*args, query_params=query_params, **kwargs)
  File "/home/fikfok/test_env/lib/python3.5/site-packages/pyelasticsearch/client.py", line 447, in bulk
    query_params=query_params)
  File "/home/fikfok/test_env/lib/python3.5/site-packages/pyelasticsearch/client.py", line 276, in send_request
    body=body)
ValueError: too many values to unpack (expected 2)
Run Code Online (Sandbox Code Playgroud)

但是它将这些文档插入到Elasticsearch中。

我用什么:

Linux Mint 18.1
Elasticsearch 5.5.0 (engine)
virtualenv
Python 3.5.2
pyelasticsearch 1.4
elasticsearch 5.4.0 (package in virtual env "test_env")
Run Code Online (Sandbox Code Playgroud)

请告诉我哪里错了以及如何解决该错误。谢谢!