python3实现elasticsearch批量更新数据
作者:拓宽视野 时间:2021-03-17 19:43:57
废话不多说,直接上代码!
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专门为更新设置的语言
来源:https://blog.csdn.net/Areigninhell/article/details/86665035
标签:python3,elasticsearch,更新数据
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
小谈MySQL字符集
2009-02-13 13:30:00
python基础之定义类和对象详解
2023-06-15 05:35:12
python快速建立超简单的web服务器的实现方法
2021-03-14 23:25:14
python3+selenium4实现切换窗口与iframe的方法
2022-08-08 16:34:16
![](https://img.aspxhome.com/file/2023/1/120431_0s.png)
SQL Server的BUILTIN\\Administrators用户
2009-02-04 13:51:00
python矩阵运算,转置,逆运算,共轭矩阵实例
2021-09-16 17:45:22
SQL Server视图管理中的四个限制条件
2009-03-06 14:24:00
Python参数解析器configparser简介
2021-04-22 02:23:31
![](https://img.aspxhome.com/file/2023/1/95781_0s.png)
PHP抽象工厂模式Abstract Factory Pattern优点与实现方式
2023-05-25 03:04:57
python3 requests库文件上传与下载实现详解
2021-10-10 15:31:07
python实现三次密码验证的示例
2022-01-24 16:34:25
![](https://img.aspxhome.com/file/2023/2/82512_0s.jpg)
认识Javascript数组
2009-08-27 15:26:00
Pycharm虚拟环境创建并使用命令行指定库的版本进行安装
2022-10-24 18:24:40
![](https://img.aspxhome.com/file/2023/2/110212_0s.png)
有关简洁网页设计需知的6点技巧
2012-04-25 20:55:01
javascript限制复选框的最大可选数
2008-10-13 13:03:00
python单线程文件传输的实例(C/S)
2023-04-07 22:45:48
![](https://img.aspxhome.com/file/2023/0/76050_0s.jpg)
python 使用 with open() as 读写文件的操作方法
2021-05-08 08:32:20
![](https://img.aspxhome.com/file/2023/1/123471_0s.jpg)
Python函数默认参数常见问题及解决方案
2023-04-03 15:42:42
基于Python实现批量保存视频到本地
2023-10-14 12:24:27
![](https://img.aspxhome.com/file/2023/7/118787_0s.png)
Mootools常用方法扩展(三)
2009-01-14 20:07:00