# How to post multiple records to same index via curl

**URL:** <https://discuss.elastic.co/t/how-to-post-multiple-records-to-same-index-via-curl/95218>\
**Category:** Elasticsearch\
**Created:** [July 31, 2017, 4:35pm UTC](https://discuss.elastic.co/t/how-to-post-multiple-records-to-same-index-via-curl/95218 "2017-07-31T16:35:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KeninHouston](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@KeninHouston](https://discuss.elastic.co/u/KeninHouston)\
**Post date:** [July 31, 2017, 4:35pm UTC](https://discuss.elastic.co/t/how-to-post-multiple-records-to-same-index-via-curl/95218/1 "2017-07-31T16:35:37Z")

</div>

Hi,

I am trying to write multiple records to the same index using curl. I can write one entry successfully, but I get a syntax error saying , unexpected when I try and add the second one. I found a posting which says I have to use the \_bulk endpoint, but when I try that I get "No handler found for uri [/composer/well/1/\_bulk] and method [PUT]"

Is there an easy way to write multiple records to the same index using curl?

---

<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:** [July 31, 2017, 5:38pm UTC](https://discuss.elastic.co/t/how-to-post-multiple-records-to-same-index-via-curl/95218/2 "2017-07-31T17:38:22Z")

</div>

[Docs says](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docs-bulk.html):

```auto
curl -XPOST 'localhost:9200/_bulk?pretty' -H 'Content-Type: application/json' -d'
{ "update" : {"_id" : "1", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "script" : { "inline": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}}
{ "update" : {"_id" : "2", "_type" : "type1", "_index" : "index1", "_retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"}, "doc_as_upsert" : true }
{ "update" : {"_id" : "3", "_type" : "type1", "_index" : "index1", "_source" : true} }
{ "doc" : {"field" : "value"} }
{ "update" : {"_id" : "4", "_type" : "type1", "_index" : "index1"} }
{ "doc" : {"field" : "value"}, "_source": true}
'

```

So basically here try with:

```auto
POST /composer/well/_bulk

```

---

<div class="post-metadata">

**Author:** ![KeninHouston](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@KeninHouston](https://discuss.elastic.co/u/KeninHouston)\
**Post date:** [July 31, 2017, 7:04pm UTC](https://discuss.elastic.co/t/how-to-post-multiple-records-to-same-index-via-curl/95218/3 "2017-07-31T19:04:21Z")

</div>

Schlumberger-Private  
Thanks for that David,

Very useful

Regards,  
Kenneth

---

<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:** [August 28, 2017, 7:04pm UTC](https://discuss.elastic.co/t/how-to-post-multiple-records-to-same-index-via-curl/95218/4 "2017-08-28T19:04:56Z")

</div>

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