在kibana中進(jìn)行批量操作:?
使用python代碼進(jìn)行對(duì)es進(jìn)行批量操作
示例代碼:
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)
運(yùn)行結(jié)果:
案例一:
python讀取mysql數(shù)據(jù)寫入ES:
參考博文:https://www.jianshu.com/p/c0e42121f054
python 批量導(dǎo)入mysql數(shù)據(jù)到Elastic Search_追逐時(shí)光的博客-CSDN博客?
參考博文:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-645615.html
Python簡(jiǎn)單實(shí)現(xiàn)與ElasticSearch交互插入數(shù)據(jù)_IT之一小佬的博客-CSDN博客_python 插入es文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-645615.html
到了這里,關(guān)于使用python對(duì)ES進(jìn)行批量操作的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!