1 Star 0 Fork 1

study/elk_study

forked from junfalin/elk_study 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
es_insert.py 608 Bytes
一键复制 编辑 原始数据 按行查看 历史
unknown 提交于 2021-03-24 17:43 +08:00 . 'volume
# -*- coding: utf-8 -*-
# ----------------------------
# @File : es_insert.py
# @Date : 2021-03-24
# @Author : jf.l
# ----------------------------
from faker import Faker
import requests, json
fk = Faker('zh_cn')
index = 'book'
type = 'novel'
url = 'http://localhost:9200/{index}/{type}/{id}'
headers = {'Content-Type': 'application/json'}
data = lambda: {
"user": fk.name(),
"title": fk.job(),
"desc": fk.text()
}
for i in range(1, 200):
res = requests.put(url.format(index=index, type=type, id=i), data=json.dumps(data()), headers=headers)
print(res.status_code, res.text)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/msy_study/elk_study.git
git@gitee.com:msy_study/elk_study.git
msy_study
elk_study
elk_study
main

搜索帮助