from elasticsearch import Elasticsearch
import json
import time es = Elasticsearch(['es地址:9200'],ignore=[400, 405, 502]) def create_user(plat,gender,b_year,b_month,uni_ids = []):
"""增数据"""
for uni_id in uni_ids:
body = {
"uni_id":uni_id,
"customer_from_plat":plat,
"gender":gender,
"constellation":12,
"birth_year":b_year,
"birth_month":b_month,
"state":"",
"city":"",
"district":"",
"email_suffix":"163.com",
"customer_child":{
"name":"customer"
}
}
print(body)
es.index(index="index_customer_yangbo",doc_type="customer",id= uni_id,body=body)
time.sleep(1) def del_date(ids=[]):
"""删数据"""
for i in ids:
es.delete(index="index_customer_yangbo", doc_type="customer", id=i)
print(f"删除了_id为{i}的值") def sc_date(ids=[]):
body = {
"query":{
"terms":{
"_id":ids
}
}
}
res = es.search(index="index_customer_yangbo",body=body) #查询
print(json.dumps(res)) create_user("JOS","F","","",["user20","user21","user22"])
#sc_date(["user20","user21","user22"])
#del_date(["user20","user21","user22"])

最新文章

  1. HTML5标签
  2. java代码效率优化
  3. haproxy配置文件
  4. 极客DIY:制作一个可以面部、自主规划路径及语音识别的无人机
  5. Android简单图片浏览器
  6. BIEEE 创建多维钻取分析(4)
  7. LR监控Windows资源
  8. 【项目管理和构建】十分钟教程,eclipse配置maven + 创建maven项目(三)
  9. centos系统python升级2.7.3
  10. trace openjdk from systemtap
  11. Java编程-第一个Java程序
  12. java与.net比较学习系列(6) 数组
  13. JAVA进阶----主线程等待子线程各种方案比较(转)
  14. cocoapods卸载重装 解决clone,install,search很慢的问题
  15. CentOS 7 yum install cobbler2.8.3
  16. spring中用到了哪些设计模式
  17. CCF2014032窗口(C语言)
  18. bzoj3879
  19. 阿里大于发送短信(java)
  20. wordpress主题升级之后返回到原来版本主题的方法

热门文章

  1. BitMap 图片格式与Base64Image格式互转方法
  2. Android Binder机制彻底梳理二
  3. TestNg用例管理
  4. new String("123") 创建了几个对象?
  5. [AGC007E] Shik and Travel
  6. 8.学习springmvc的拦截器
  7. 洛谷P2293 高精开根
  8. 某邀请赛misc key阉割发行版
  9. [技术博客]使用PanResponder实现响应左右滑动手势
  10. HTTP协议之multipart/form-data