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

 

  

  

相关文章:

  • 2022-12-23
  • 2021-08-20
  • 2021-11-11
  • 2021-12-11
  • 2021-04-04
  • 2022-01-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2022-01-16
相关资源
相似解决方案