# Probleme using bulk

**URL:** <https://discuss.elastic.co/t/probleme-using-bulk/90297>\
**Category:** Elasticsearch\
**Created:** [June 21, 2017, 1:29pm UTC](https://discuss.elastic.co/t/probleme-using-bulk/90297 "2017-06-21T13:29:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Peere](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Benjamin\_Peere](https://discuss.elastic.co/u/Benjamin_Peere)\
**Post date:** [June 21, 2017, 1:29pm UTC](https://discuss.elastic.co/t/probleme-using-bulk/90297/1 "2017-06-21T13:29:26Z")

</div>

Hello everyone, i'm new using elasticsearch,  
i am trying to index a json file with bulk, but it doesn't work,  
i use jq to have the good format :  
cat monitor.json | jq -c '.[] | {"index": {"\_index": "monitoring", "\_type": "monitoring", "\_id": .id}}, .'

this is the result :

{"index":{"\_index":"monitoring","\_type":"monitoring","\_id":null}}  
{"temperature":"47","cpu":"1","ramtotal":"925","ramlibre":"502","ramswap":"0","memoireutil":"21","ramutil":"423","hdmi":"0x40001","ping":"4","date":"2017-06-21"}

and when i try to add it with the following line :  
cat monitor.json | jq -c '.[] | {"index": {"\_index": "monitoring", "\_type": "monitoring", "\_id": .id}}, .' | curl --header "Content-Type:application/json" -XPOST localhost:9200/\_bulk --data-binary @monitor.json

i get this error :  
{"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"Malformed action/metadata line [1], expected START\_OBJECT or END\_OBJECT but found [FIELD\_NAME]"}],"type":"illegal\_argument\_exception","reason":"Malformed action/metadata line [1], expected START\_OBJECT or END\_OBJECT but found [FIELD\_NAME]"},"status":400}

do you have an idea of what is the problem?

thank you!

---

<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:** [June 21, 2017, 4:37pm UTC](https://discuss.elastic.co/t/probleme-using-bulk/90297/2 "2017-06-21T16:37:39Z")

</div>

Please format your code using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

I would not define id to null. I'd just keep setting it.  
Not sure it's the problem here though.

May be reproduce with a sample script as explained in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21)

---

<div class="post-metadata">

**Author:** ![Benjamin\_Peere](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@Benjamin\_Peere](https://discuss.elastic.co/u/Benjamin_Peere)\
**Post date:** [June 22, 2017, 9:39am UTC](https://discuss.elastic.co/t/probleme-using-bulk/90297/3 "2017-06-22T09:39:21Z")

</div>

thank tou, it works now!

---

<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 20, 2017, 9:39am UTC](https://discuss.elastic.co/t/probleme-using-bulk/90297/4 "2017-07-20T09:39:22Z")

</div>

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