我们可以在ElasticSearch中进行批量更新而不指定文档id吗。没有documentid,我无法进行批量更新,有没有办法通过queryby方法进行批量更新
length = len(test_final)
steps = 100
for i in range(0, length, steps):
end_index = length-1 if i+steps>length else i+steps
temp_list = test_final[i: end_index]
bulk_file = ''
actions = [{
"_op_type": "update",
"_index": "test_detail",
"_type": "test_datas",
"upsert": {
{source['dataId']:{
"test_value": int(test_data ['test_value'])
}}
},
"script":{ "query": {
"term": {
"test_Id": test_data ['dataId']
}
}}}
for test_data in temp_list
]
helpers.bulk(es, actions)
暂无答案!
目前还没有任何答案,快来回答吧!