0

I am new to elasticsearch, running elasticsearch from chrome:extension- Postman. I want to enter bulk data into it, from JSON using Bulk API. I have seen the command :

curl -s -XPOST 'http://jfblouvmlxecs01:9200/_bulk' --data-binary @bulk.json 

While using Postman, I do not know where to store the file @bulk.json, Currently I have stored it at C:\elasticsearch-1.5.2\bin\bulk.JSON

The command I am using is http://localhost:9200/_bulk --data-binary @bulk.JSON This is throwing following error:

"error": "InvalidIndexNameException[[_bulk --data-binary @bulk.JSON] Invalid index name [_bulk --data-binary @bulk.JSON], must not contain the following characters [\, /, *, ?, \", <, >, |, , ,]]", "status": 400 }

Can someone please suggest, where to store the JSON file. Or am I doing something wrong here.

cramopy
  • 3,459
  • 6
  • 28
  • 42
GGN
  • 85
  • 11
  • 1
    What you're seeing works for `curl` commands. In Postman, it works differently, simply put the content of your bulk.json file in the body. See this answer which should help: http://stackoverflow.com/questions/22996337/elasticsearch-no-requests-added-bulk-api-error – Val Jun 02 '15 at 20:47
  • Also see this link which shows exactly how to call `_bulk` from Postman: http://red-badger.com/blog/2013/11/08/getting-started-with-elasticsearch/ – Val Jun 03 '15 at 04:47
  • Thank you Val. Your answers really helped me! My JSON file is huge, so pasting it in Postman body was creating some problems , and Postman ends up crashing. I guess the only was is to split the JSON file and paste it. Thanks once again! – GGN Jun 03 '15 at 13:44
  • Why not going the `curl` way if your file is too big? – Val Jun 03 '15 at 14:27
  • I have never used `curl` before. Just started experimenting with it now. – GGN Jun 04 '15 at 13:50
  • Give it a try, it's straightforward for what you want to do. – Val Jun 04 '15 at 13:55

1 Answers1

0

You can store your file anywhere and then pass the path like this:

curl -s -XPOST 'http://jfblouvmlxecs01:9200/_bulk' --data-binary @"/blah/blah/bulk.json"

If you want to do it with postman there is an answer here that explains how

But if you want to use this for large data, I wouldn't recommend using postman or sense. Use curl directly or logstash

See also this: https://github.com/taskrabbit/elasticsearch-dump

Community
  • 1
  • 1
elachell
  • 2,527
  • 1
  • 26
  • 25