2

I am trying to import the accounts.json data using _bulk api as per the elastic search tutorial( https://www.elastic.co/guide/en/kibana/current/getting-started.html ). I'm using google-chrome's Sense plugin for this task.

When i paste the url curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json on Sense, its converted to POST /bank/account/_bulk?pretty.

The solution here : Kibana: Cant import Shakespeare.json on Sense Web Plugin, says, to use CURL command. But on windows, the curl command is not recognized.

curl -XPUT localhost:9200/_bulk --data-binary @shakespeare.json 'curl' is not recognized as an internal or external command, operable program or batch file.

Community
  • 1
  • 1
imAmanRana
  • 123
  • 1
  • 3
  • 9
  • You can download curl for Windows at https://curl.haxx.se/download.html – Val Feb 28 '16 at 05:48
  • @Val This is also not working correctly, getting this error: `curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json` `curl: (6) Could not resolve host: 'localhost '` – imAmanRana Feb 29 '16 at 02:57
  • 1
    OK, I got it, it worked with : `curl -XPOST localhost:9200/bank/account/_bulk?pretty --data-binary @accounts.json`. Thanks a lot :) – imAmanRana Feb 29 '16 at 03:56
  • In which path you saved the accounts.jason file... How to mention the path in Chrome Sense –  Jun 08 '16 at 06:12
  • The current version of sense does not support **--data-binary** option, so we cannot specify the data file. For this either use the **curl** command or perform a **_bulk** import. – imAmanRana Jun 13 '16 at 03:52

2 Answers2

2

Try this:

POST /<indexName>/<type>/_bulk

Copy the contents of the files accounts.json

and run.

Nishant
  • 450
  • 2
  • 6
  • 1
    This process is ok with small amount of data, but when the data is very large, the copy-paste doesn't work. – imAmanRana Feb 28 '16 at 17:28
0

Just to have the correct answer:

  1. Download curl for Windows here: https://curl.haxx.se/download.html

    Direct link to curl-7.54.1-win64-mingw

  2. Unpack the bin folder from the archive somewhere on your local drive.

  3. Add the path to that folder to your PATH system variable.

  4. Restart your explorer.exe process or restart Windows. This is needed in order for the shell to refresh the value of PATH.

  5. In the command-line shell, execute the following command:

    curl -XPOST localhost:9200/{some path here}/_bulk?pretty --data-binary @{file name}
    
Dmytro Shevchenko
  • 33,431
  • 6
  • 51
  • 67