# Add data using bulk API

**URL:** <https://discuss.elastic.co/t/add-data-using-bulk-api/135256>\
**Category:** Elasticsearch\
**Created:** [June 10, 2018, 8:46am UTC](https://discuss.elastic.co/t/add-data-using-bulk-api/135256 "2018-06-10T08:46:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parv\_Arora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parv_arora/32/32097_2.png) [@Parv\_Arora](https://discuss.elastic.co/u/Parv_Arora)\
**Post date:** [June 10, 2018, 8:46am UTC](https://discuss.elastic.co/t/add-data-using-bulk-api/135256/1 "2018-06-10T08:46:59Z")

</div>

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 !!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 8, 2018, 8:47am UTC](https://discuss.elastic.co/t/add-data-using-bulk-api/135256/2 "2018-07-08T08:47:06Z")

</div>

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