# Error while uploading bulk json to elasticsearch domain

**URL:** <https://discuss.elastic.co/t/error-while-uploading-bulk-json-to-elasticsearch-domain/325774>\
**Category:** Elasticsearch\
**Created:** [February 16, 2023, 8:12pm UTC](https://discuss.elastic.co/t/error-while-uploading-bulk-json-to-elasticsearch-domain/325774 "2023-02-16T20:12:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![truptivala](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@truptivala](https://discuss.elastic.co/u/truptivala)\
**Post date:** [February 16, 2023, 8:12pm UTC](https://discuss.elastic.co/t/error-while-uploading-bulk-json-to-elasticsearch-domain/325774/1 "2023-02-16T20:12:02Z")

</div>

I am trying to upload the below json file to the elasticsearch domain I have on aws and getting the below error:

Input json file:

```auto
{"index": {"_index": "ods-pcd-poc","_id": "1"}}{"Page": 0,"Path": "//Document/Figure","Text": ""}{"index": {"_index": "ods-pcd-poc","_id": "2"}}{"Page": 0,"Path": "//Document/P","Text": "GUIDELINES FOR PATIENTS 2022 Non-Small Cell Lung Cancer Metastatic "}{"index": {"_index": "ods-pcd-poc","_id": "3"}}{"Page": 0,"Path": "//Document/Figure[2]","Text": ""}{"index": {"_index": "ods-pcd-poc","_id": "4"}}{"Page": 0,"Path": "//Document/P[2]/Reference","Text": "(<http://www.nccn.org/patients>)Available online at NCCN.org/patients "}

```

Command:  
curl -XPUT '/\_bulk' --data-binary @example.json -H 'Content-Type: application/json'

Error:  
`{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: no requests added;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: no requests added;"},"status":400}`

I have added new line char at the end of the file. What is the possible cause of this error?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 16, 2023, 8:14pm UTC](https://discuss.elastic.co/t/error-while-uploading-bulk-json-to-elasticsearch-domain/325774/2 "2023-02-16T20:14:53Z")

</div>

You also need a newline between each JSON object.

```auto
{"index": {"_index": "ods-pcd-poc","_id": "1"}}
{"Page": 0,"Path": "//Document/Figure","Text": ""}
{"index": {"_index": "ods-pcd-poc","_id": "2"}}
{"Page": 0,"Path": "//Document/P","Text": "GUIDELINES FOR PATIENTS 2022 Non-Small Cell Lung Cancer Metastatic "}
...

```

---

<div class="post-metadata">

**Author:** ![truptivala](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@truptivala](https://discuss.elastic.co/u/truptivala)\
**Post date:** [February 16, 2023, 8:18pm UTC](https://discuss.elastic.co/t/error-while-uploading-bulk-json-to-elasticsearch-domain/325774/3 "2023-02-16T20:18:36Z")

</div>

thanks! it worked.

---

<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:** [March 16, 2023, 8:18pm UTC](https://discuss.elastic.co/t/error-while-uploading-bulk-json-to-elasticsearch-domain/325774/4 "2023-03-16T20:18:55Z")

</div>

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