Loading Sample Dataset

I have trouble for the load dataset. I have a json dataset and I wanna load on Elasticsearch 5.3
my json dataset is at C:/elk/elasticsearch/data/account.json I want to use this => and I use
curl -H "Content-Type: application/json" -XPOST 'localhost:9200/bank/account/_bulk?pretty&refresh' --data-binary "@accounts.json"
code, how to change this code for use and receive this
response for curl 'localhost:9200/_cat/indices?v'

    health status index uuid                   pri rep docs.count docs.deleted store.size pri.store.size
    yellow open   bank  l7sSYV2cQXmu6_4rJWVIww   5   1       1000            0    128.6kb        128.6kb

What does the account.json file look like? The bulk API expects a specific format, with metadata about the documents to index on one line, followed by the actual document. See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

my accounts.json file is accounts.json
I couldn't solve this, I receive parse error on kibana server when I wanna index this dataset. Can you explain this little more?

What error message are you getting? I just tried the command you provided locally and it worked for me on a fresh install of Elasticsearch 5.3.0.

It seems like this.

And I also receive like this when I look F12

then I receive

" Failed to connect to Console's backend.
Please check the Kibana server is up and running"

but I see Kibana server is open. I'm confused :no_mouth:

Oh, this command is expected to be run on the command-line, not from Kibana's console. If you want to run it from Kibana's console, here is what you need to run:

POST bank/account/_bulk?pretty&refresh
{"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"}
{"index":{"_id":"13"}}
{"account_number":13,"balance":32838,"firstname":"Nanette","lastname":"Bates","age":28,"gender":"F","address":"789 Madison Street","employer":"Quility","email":"nanettebates@quility.com","city":"Nogal","state":"VA"}
{"index":{"_id":"18"}}
{"account_number":18,"balance":4180,"firstname":"Dale","lastname":"Adams","age":33,"gender":"M","address":"467 Hutchinson Court","employer":"Boink","email":"daleadams@boink.com","city":"Orick","state":"MD"}
{"index":{"_id":"20"}}
{"account_number":20,"balance":16418,"firstname":"Elinor","lastname":"Ratliff","age":36,"gender":"M","address":"282 Kings Place","employer":"Scentric","email":"elinorratliff@scentric.com","city":"Ribera","state":"WA"}
{"index":{"_id":"25"}}
{"account_number":25,"balance":40540,"firstname":"Virginia","lastname":"Ayala","age":39,"gender":"F","address":"171 Putnam Avenue","employer":"Filodyne","email":"virginiaayala@filodyne.com","city":"Nicholson","state":"PA"}
{"index":{"_id":"32"}}
{"account_number":32,"balance":48086,"firstname":"Dillard","lastname":"Mcpherson","age":34,"gender":"F","address":

GET _cat/indices?v

I truncated the content of accounts.json to keep it readable, but to have 1000 docs in the end as expected, you need to put the whole content of that file below the POST _bulk line.

1 Like

Oh, thank you. I'm trying wrong function for three days... Thanks for the solution :relaxed:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.