Add data using bulk API


(Parv Arora) #1

Hello ,
I tried loading data using bulk api .

Mapping

PUT /iriss
{
"mappings": {
"doc":{
"properties": {
"sepalLength":{"type": "float"},
"sepalWidth" :{"type": "float"},
"petalLength" :{"type": "float"},
"petalWidth" :{"type": "float"},
"species" :{"type": "text"}
}
}
}
}

Data

{"index" : {}}\n{"sepalLength": 5.1, "sepalWidth": 3.5, "petalLength": 1.4, "petalWidth": 0.2, "species": "setosa"}\n{"index" : {}}\n{"sepalLength": 4.9, "sepalWidth": 3.0, "petalLength": 1.4, "petalWidth": 0.2, "species": "setosa"}\n

Curl Command issued

curl -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/iriss/doc/_bulk?pretty&refresh" --data-binary @iris.json

I am getting the following error

{
"took" : 2,
"errors" : true,
"items" : [
{
"index" : {
"_index" : "iriss",
"_type" : "doc",
"_id" : "MHnZ6GMBC7vYORn5sjQn",
"status" : 400,
"error" : {
"type" : "mapper_parsing_exception",
"reason" : "failed to parse, document is empty"
}
}
}
]
}

Please help !!


(system) #2

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