首页 > 开发 > Python > 正文

python3实现elasticsearch批量更新数据

2020-07-28 13:54:50
字体:
来源:转载
供稿:网友

废话不多说,直接上代码!

updateBody = {    "query":{      "range":{       "write_date": {        "gte": "2019-01-15 12:30:17",        "lte": "now"       }       }    },  "script": {    "inline": "ctx._source.index = params.index",    "params": {      "index": 211    },    "lang":"painless"   }}es_client.update_by_query(index="log_index",doc_type='log_index',body=updateBody)

提醒:批量更新可以针对id进行更新

注意:painless 是es专门为更新设置的语言

以上这篇python3实现elasticsearch批量更新数据就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持错新网之家。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表