I want to insert the docs contained my my_docs.json
into my elasticsearch index. My json file looks like this:
{"_index":"twitter","_type":"_doc","_id":"v8XSJ2cB_TizemYYi5mW","_score":1,"_source":{"user":"me","c":"2018-11-18T17:16:08.953Z","content":"this is cool stuff"}}
{"_index":"twitter","_type":"_doc","_id":"x8XbJ2cB_TizemYYxZmf","_score":1,"_source":{"user":"you","c":"2018-11-18T17:26:13.634Z","content":"this is some other cool stuff"}}
I tried: curl -XPUT 'http://localhost:9200/twitter/_bulk?pretty&refresh' -H "Content-Type: application/json" -d @my_docs.json
where twitter
is my index.
I got an error:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
}
],
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
},
"status" : 400
}
I added a '\n' to the end of the file, but the problem persisted and I got the same error.
How do I fix this?