Elasticsearch bulk insert data
Use bulk batch operations database
1. Create a batch file operations
format:
{"index":{"_index":"home","_type":"home",""_id":"2"}}
{"id": 2, "location": "南京市栖霞区马群街道29号", "money": 3000, "area":80, "type": "三居室", "style": "整租"}
The first line specifies the request with the index and type, you can select the request has "the Create", "index", "the Delete", "ubdate",
"_index" specified index name, "_ type" specifies the type name, "_ id" specified id
The second line specifies the inserted content.
As request.json:
{"index":{"_index":"home","_type":"home","_id":"2"}}
{"id": 2, "location": "南京市栖霞区马群街道29号", "money": 3000, "area":80, "type": "三居室", "style": "整租"}
{"index":{"_index":"home","_type":"home","_id":"3"}}
{"id": 3, "location": "南京市玄武区山西路门路29号", "money": 400, "area":15, "type": "四居室", "style": "合租"}
{"index":{"_index":"home","_type":"home","_id":"4"}}
{"id": 4, "location": "南京市秦淮区山北京东路29号", "money": 500, "area":14, "type": "三居室", "style": "合租"}
{"index":{"_index":"home","_type":"home","_id":"5"}}
{"id": 5, "location": "南京市秦淮区新街口29号", "money": 450, "area":16, "type": "四居室", "style": "合租"}
2. Perform batch file operations
In the database to perform root directory:
curl -XPUT 'localhost:9200/_bulk' -H "Content-Type: application/json" --data-binary @request.json