1. data.json数据文件格式
{"create":{"_index":"qs_test"}}
{"userId":"1","cateId":"cateId01"}
{"create":{"_index":"qs_test"}}
{"userId":"2","cateId":"cateId02"}
{"create":{"_index":"qs_test"}}
{"userId":"3","cateId":"cateId03"}
注意:文件最后一行一定要有一行换行。否则会报错
2. 批量导入
执行curl命令进行批量导入
curl -H "Content-Type: application/json" -XPOST http://elasticusername:elasticpassword@localhost:9200/_bulk?pretty --data-binary @data.json