Download file https://github.com/elastic/elasticsearch/blob/master/docs/src/test/resources/accounts.json?raw=true
File looks like below,it is not json array but in different form
{"index":{"_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_id":"6"}}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
Now in postman
Keep Endpoint as localhost:9200/accounts/docs/_bulk
set request header Content-Type:application/json
select body to be binary and select file as account.json
Response:
{
"took": 593,
"errors": false,
"items": [
{
"index": {
"_index": "accounts",
"_type": "docs",
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1,
"status": 201
}
},
{
"index": {
"_index": "accounts",
"_type": "docs",
"_id": "6",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 1,
"_primary_term": 1,
"status": 201
}
},
//more entries here
]
}
With Postman you can view all inserted records with GET request against URL localhost:9200/accounts/_search?pretty&size=1000
No comments:
Post a Comment