【发布时间】:2016-03-30 07:07:33
【问题描述】:
我想向 ES 发送 n 个 upsert 部分请求,这可能吗? 因此,如果文档不存在,请插入我的部分文档。如果已存在,请使用部分文档进行更新。
使用批量助手,我尝试了很多变体,但它们都消除了现有值以支持新值。
data = [{
"_index": 'my_index',
"_type": 'my_type',
"_id": 12345,
"doc": {"newkey": 'newvalue'}
}]
helpers.bulk(es, data, index='my_index', doc_type='my_type')
或
data = [{
"_index": 'my_index',
"_type": 'my_type',
"_id": 12345,
"_source": {"newkey": 'newvalue'}
}]
helpers.bulk(es, data, index='my_index', doc_type='my_type')
也不行。
【问题讨论】:
标签: python elasticsearch upsert