def create_module_index(module_name):
url = "http://localhost:9200/{}".format(module_name.lower())
with open("./create_index.json", "r", encoding="utf-8") as file_object:
json_obj = json.load(file_object)
rep = session.put(url, json=json_obj)
print(rep.status_code)
print(rep.text)
1、python对json的操作总结
https://www.cnblogs.com/loleina/p/5623968.html
2、Python JSON
http://www.runoob.com/python/python-json.html
本文介绍了一个使用Python创建Elasticsearch模块索引的方法,通过构造URL并读取JSON配置文件来定义索引结构,最终利用session发起PUT请求完成索引创建。此外还提供了关于Python操作JSON数据的相关资源链接。
2247

被折叠的 条评论
为什么被折叠?



