"parse_exception",

why I am getting this Exception to upload the Data into elastic search....? can anyone tell the reason and solution for this please...

curl -XPUT 'localhost:9200/abcfile11?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"log": {
"properties":
{
"name": {"type": "keyword"}
"id": {"type": "integer"}
}
}
}
}
'
It got success but below code is rising problem

anil@anil-OptiPlex-390:~/ANIL$ curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/a2/log/_bulk?pretty' --data-binary @abcfile11.jsonl
Warning: Couldn't read data from file "abcfile11.jsonl", this makes an empty
Warning: POST.
{
"error" : {
"root_cause" : [
{
"type" : "parse_exception",
"reason" : "request body is required"
}
],
"type" : "parse_exception",
"reason" : "request body is required"
},
"status" : 400
}

thanks in Advance!...

What's in the file?

it is a abcfile11.jsonl file It has some students data id,name

That doesn't explain what is inside the file, the contents.
Can you show that?

below is the file data

{"index":{"_index":"a2","_type":"log"}}
{"id" : 9, "name" : "rasi"}
{"index":{"_index":"a2","_type":"log"}}
{"id" :16 , "name" : "venkatesh"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 11, "name" : "sandeep"}

{"index":{"_index":"a2","_type":"log"}}

{"id" : 10, "name" : "satendra"}

{"index":{"_index":"a2","_type":"log"}}
{"id" : 13, "name" : "mukesh"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 14, "name" : "sairam"}

{"index":{"_index":"a2","_type":"log"}}
{"id" : 1, "name" : "sekhar"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 2, "name" : "anil"}

{"index":{"_index":"a2","_type":"log"}}
{"id" : 3, "name" : "durga"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 4, "name" : "sunil"}

{"index":{"_index":"a2","_type":"log"}}
{"id" : 5, "name" : "kiranmai"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 6, "name" : "raviteja"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 7, "name" : "teja"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 8, "name" : "mass"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 15, "name" : "rajesh"}
{"index":{"_index":"a2","_type":"log"}}
{"id" : 12, "name" :"snr"}

Please format your code using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Please edit your post.

2 things might happen:

  • You file is not picked up by the curl command. Have a look at the curl documentation. It might differ depending on your OS.
  • Here you file is incorrect. It has some blank lines in it.
1 Like

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