Elasticsearch 添加数据

Elasticsearch 添加数据
# 添加ES 数据
curl -X POST 10.44.99.102:9200/situation-event/situation-event -d {}
  

Elasticsearch 批量添加数据

首先我们先构造一个 json文件,内容参考如下:

复制代码
{"index": {"_index": "situation-event"}
{"question": "通过源码安装进行到第四步的时候空白", "anwser":"anwser1"}
{"index": {"_index": "situation-event"}
{"question": "为什么windows一键安装包apache无法启动?", "anwser":"anwser2"}
{"index": {"_index": "situation-event"}
{"question": "windows一键安装包默认的用户名和密码是什么?", "anwser":"anwser3"}
{"index": {"_index": "situation-event"}}
{"question": "windows一键安装包无法开机自动启动", "anwser":"anwser4"}
{"index": {"_index": "situation-event"}}
{"qustion": "安装的时候提示没有pdo扩展", "anwser":"anwser5"}
复制代码

  

 在json文件所在文件夹执行以下命令: 

curl -X POST "10.44.99.102:9200/_bulk?pretty" -H "Content-Type: application/json;charset=UTF-8" --data-binary @test.json

  

插入数据的时候他会有一段时间去执行,你需要立即让他去执行添加
# 立即添加
curl -X GET 10.44.99.102:9200/situation-event/_refresh

 

  

  

posted @   你的小可爱吖  阅读(6111)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧

阅读目录(Content)

此页目录为空

点击右上角即可分享
微信分享提示