在kibana中进行批量操作:
使用python代码进行对es进行批量操作
示例代码:
from elasticsearch import Elasticsearch
es = Elasticsearch(hosts='http://127.0.0.1:9200')
# print(es)
doc = [
{"create": {"_index": "test_index", "_id": "5"}},
{"doc": {"name": "张三", "id": "1"}},
{"update": {"_index": "test_index", "_id": "2"}},
{"doc": {"name": "李四666", "id": "2"}},
{"update": {"_index": "test_index", "_id": "3"}},
{"doc": {"name": "王五666", "id": "3"}},
{"delete": {"_index": "test_index", "_id": "4"}},
]
res = es.bulk(index="test_index", body=doc)
print(res)
运行结果:
案例一:
python读取mysql数据写入ES:
参考博文:https://www.jianshu.com/p/c0e42121f054
python 批量导入mysql数据到Elastic Search_追逐时光的博客-CSDN博客
参考博文:文章来源:https://www.toymoban.com/news/detail-645615.html
Python简单实现与ElasticSearch交互插入数据_IT之一小佬的博客-CSDN博客_python 插入es文章来源地址https://www.toymoban.com/news/detail-645615.html
到了这里,关于使用python对ES进行批量操作的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!