pyelasticsearch批量值错误:太多的值无法解压缩(应为2)

2024-09-29 01:35:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我是Python和Elasticsearch的新手。 我正在尝试编写代码,用bulk在elasticsearch中插入文档。基于以下描述: 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')

Python返回以下错误消息:

^{pr2}$

但它会将这些文档插入到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")

请告诉我我哪里错了,如何改正错误。谢谢!在


Tags: 代码文档envidindexdocesbulk