# Loading own json data using Bulk\_API gives error

**URL:** <https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106>\
**Category:** Elasticsearch\
**Created:** [May 27, 2016, 2:12am UTC](https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106 "2016-05-27T02:12:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kausik93](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@kausik93](https://discuss.elastic.co/u/kausik93)\
**Post date:** [May 27, 2016, 2:12am UTC](https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106/1 "2016-05-27T02:12:00Z")

</div>

Hi, I've generated my JSON data from a csv (excel) file and I'm trying to upload it. The code I'm using to update the data is `curl -XPOST 'http://localhost:9200/jobs/2014_jobs/_update?pretty' --data-binary '@data.json'` but I get the error

> {  
> "error" : {  
> "root\_cause" : [ {  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "failed to parse"  
> } ],  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "failed to parse",  
> "caused\_by" : {  
> "type" : "illegal\_argument\_exception",  
> "reason" : "Malformed content, found extra data after parsing: START\_OBJECT"  
> }  
> },  
> "status" : 400  
> }

So far I can tell that the error is with the strucutre of my JSON object itself. I've read the Bulk\_API to see if there is anything wrong with the way my code is structured but I cannot find anything. Does anyone know why I am getting this error? Part of JSON file below. Thank you very much 🙂

> {"index": {"\_index": "jobs", "\_id": 119556, "\_type": "2014\_jobs"}}  
> {"job category": "Logistics / Supply Chain|Purchasing / Merchandising|Human resource consultancy services|Full Time|Executive|Manager|Middle Management|", "closing date": "28-Dec-14", "salary": "Not published", "posting date": "28-Nov-14", "working hours": "-", "company": "", "contact": "+65 66454545 / ctay sg. drakeintl. com", "description": "", "title": "Logistics Category Manager", "job level": "Executive|Manager|Middle Management", "shift pattern": "Day Shift", "job id": "JOB-2014-0119556", "industry": "Human resource consultancy services", "employment type": "Full Time", "min years of experience": "8", "skills": "", "timestamp": "1.41973E+12", "address": "1 RAFFLES PLACE| 20-01 ONE RAFFLES PLACE||Singapore 048616|"}  
> {"index": {"\_index": "jobs", "\_id": 119700, "\_type": "2014\_jobs"}}  
> {"job category": "F B|Hospitality|Logistics / Supply Chain|Purchasing / Merchandising|Hotels with restaurant|Full Time|Fresh/entry level|Non-executive|", "closing date": "28-Dec-14", "salary": "Not published", "posting date": "28-Nov-14", "working hours": "44 hours a week", "company": "DAISHO DEVELOPMENT SINGAPORE PTE LTD", "contact": "Not available", "description": "", "title": "Culinary Logistic Agent", "job level": "Fresh/entry level|Non-executive", "shift pattern": "No Shift", "job id": "JOB-2014-0119700", "industry": "Hotels with restaurant", "employment type": "Full Time", "min years of experience": "1", "skills": "", "timestamp": "1.41973E+12", "address": "12 MARINA VIEW| 35-00 ASIA SQUARE TOWER 2||Singapore 018961|"}  
> {"index": {"\_index": "jobs", "\_id": 118701, "\_type": "2014\_jobs"}}  
> {"job category": "Architecture / Interior Design|Architectural services|Permanent|", "closing date": "30-Dec-14", "salary": "Not published", "posting date": "27-Nov-14", "working hours": "8am - 6pm", "company": "LOOK ARCHITECTS PTE. LTD. ", "contact": "jasmin lookarchitects. com", "description": "", "title": "Resident Technical Officer (RTO)", "job level": "-", "shift pattern": "No Shift", "job id": "JOB-2014-0118701", "industry": "Architectural services", "employment type": "Permanent", "min years of experience": "5", "skills": "", "timestamp": "1.41973E+12", "address": "18 BOON LAY WAY| 09-135 TRADEHUB 21||Singapore 609966|"}

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 27, 2016, 7:04am UTC](https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106/2 "2016-05-27T07:04:22Z")

</div>

`_update` endpoint is not `_bulk` endpoint.

- [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-update.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-update.html)
- [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-bulk.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-bulk.html)

But your error might be something else though.

---

<div class="post-metadata">

**Author:** ![kausik93](https://avatars.discourse-cdn.com/v4/letter/k/e19b73/32.png) [@kausik93](https://discuss.elastic.co/u/kausik93)\
**Post date:** [May 27, 2016, 8:16am UTC](https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106/3 "2016-05-27T08:16:05Z")

</div>

Hey David! Thanks for replying. I found the error - it was in the way the Json file was generated. I'm having another issue now. I scripted 100 pairs of json objects and uploaded them to elasticsearch running locally. However in indices stats, the docs.count is only 97 whereas there are 3 docs.deleted. Would you know how I could find out more about the 3 that were deleted? I've been trying to find out more about them and I haven't found anything useful online. Thank you.

Edit: I figured out what was wrong. Thanks anyway!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 27, 2016, 8:46am UTC](https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106/4 "2016-05-27T08:46:00Z")

</div>

You'd better open a new thread.

That said may be you are using the same id for some documents?

---

<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 5, 2017, 10:48pm UTC](https://discuss.elastic.co/t/loading-own-json-data-using-bulk-api-gives-error/51106/5 "2017-07-05T22:48:33Z")

</div>


