# Problem bulk indexing

**URL:** https://discuss.elastic.co/t/problem-bulk-indexing/3742
**Category:** Elasticsearch
**Created:** [January 4, 2011, 10:48pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742 "2011-01-04T22:48:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![searchersteve](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchersteve/32/3008_2.png) [@searchersteve](https://discuss.elastic.co/u/searchersteve)
#### Post date: [January 4, 2011, 10:48pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/1 "2011-01-04T22:48:51Z")

</div>

More newbie questions...

I am trying out bulk indexing for the first time, running one line of the example from the manual:

curl -XPUT '[http://localhost:9200/\_bulk](http://localhost:9200/_bulk)' -d '{ "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }'

The result is an error:

{"error":"ActionRequestValidationException[Validation Failed: 1: no requests added]"}

It seems a mystery to me. I've read through this [thread](http://elasticsearch-users.115913.n3.nabble.com/Bulk-via-curl-not-working-in-data-in-file-td1793039.html) and other posts from Lukáš Vlček, but I'm not even able to get the most basic bulk operation going.

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [January 5, 2011, 11:44am UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/2 "2011-01-05T11:44:55Z")

</div>

> curl -XPUT '[http://localhost:9200/\_bulk](http://localhost:9200/_bulk)' -d '{ "index" : { "\_index" :  
> "test", "\_type" : "type1", "\_id" : "1" } }'

You're missing the final newline. Try this instead:

curl -XPUT '[http://localhost:9200/\_bulk](http://localhost:9200/_bulk)' -d '  
{ "index" : { "\_index" :"test", "\_type" : "type1", "\_id" : "1" } }  
'

clint

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [January 5, 2011, 12:31pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/3 "2011-01-05T12:31:18Z")

</div>

There should also be the actual json document to index, in another new line,  
and then a new line to end it all.

On Wed, Jan 5, 2011 at 1:44 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> > curl -XPUT '[http://localhost:9200/\_bulk](http://localhost:9200/_bulk)' -d '{ "index" : { "\_index" :  
> > "test", "\_type" : "type1", "\_id" : "1" } }'
> 
> You're missing the final newline. Try this instead:
> 
> curl -XPUT '[http://localhost:9200/\_bulk](http://localhost:9200/_bulk)' -d '  
> { "index" : { "\_index" :"test", "\_type" : "type1", "\_id" : "1" } }  
> '
> 
> clint

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [January 5, 2011, 12:35pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/4 "2011-01-05T12:35:32Z")

</div>

On Wed, 2011-01-05 at 14:31 +0200, Shay Banon wrote:

> There should also be the actual json document to index, in another new  
> line, and then a new line to end it all.

oh yes 🙂

> On Wed, Jan 5, 2011 at 1:44 PM, Clinton Gormley  
> [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:
> 
> ```
> > curl -XPUT 'http://localhost:9200/_bulk' -d '{ "index" :
> { "_index" :
> > "test", "_type" : "type1", "_id" : "1" } }'
>     
>     
>     
> You're missing the final newline. Try this instead:
>     
> curl -XPUT 'http://localhost:9200/_bulk' -d '
> { "index" : { "_index" :"test", "_type" : "type1", "_id" :
> "1" } }
> '
>     
>     
> clint
> 
> ```

--  
Web Announcements Limited is a company registered in England and Wales,  
with company number 05608868, with registered address at 10 Arvon Road,  
London, N5 1PR.

---

<div class="post-metadata">

### Author: ![searchersteve](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchersteve/32/3008_2.png) [@searchersteve](https://discuss.elastic.co/u/searchersteve)
#### Post date: [January 5, 2011, 5:19pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/5 "2011-01-05T17:19:25Z")

</div>

Those two suggestions did the trick! I was leaving out the document contents to simplify the test, but obviously that was an _over_-simplification... Thanks Shay, Clint.

At the risk of outlasting my welcome, I did have a separate bulk index question: What is the limit on # of documents I can ship in one API call to \_bulk? I'm sure the answer depends on size of docs and specs of my server, but do you have any kind of guidelines on what would constitute a ridiculously huge payload?

Steve

On Wed, 2011-01-05 at 14:31 +0200, Shay Banon wrote: \> There should also be the actual json document to index, in another new \> line, and then a new line to end it all.

oh yes 🙂

> On Wed, Jan 5, 2011 at 1:44 PM, Clinton Gormley  
> [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:
> 
> ```
> > curl -XPUT 'http://localhost:9200/_bulk' -d '{ "index" :
> { "_index" :
> > "test", "_type" : "type1", "_id" : "1" } }'
>     
>     
>     
> You're missing the final newline. Try this instead:
>     
> curl -XPUT 'http://localhost:9200/_bulk' -d '
> { "index" : { "_index" :"test", "_type" : "type1", "_id" :
> "1" } }
> '
>     
>     
> clint
> 
> ```

--  
Web Announcements Limited is a company registered in England and Wales,  
with company number 05608868, with registered address at 10 Arvon Road,  
London, N5 1PR.

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [January 5, 2011, 5:30pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/6 "2011-01-05T17:30:34Z")

</div>

The bulk request ends up being represented in memory on the receiving node,  
and broken down in request per shard. So its really up to the memory  
allocation and the number of concurrent bulk requests.

On Wed, Jan 5, 2011 at 7:19 PM, searchersteve [stevesuo@gmail.com](mailto:stevesuo@gmail.com) wrote:

> Those two suggestions did the trick! I was leaving out the document  
> contents  
> to simplify the test, but obviously that was an over-simplification...  
> Thanks Shay, Clint.
> 
> At the risk of outlasting my welcome, I did have a separate bulk index  
> question: What is the limit on # of documents I can ship in one API call to  
> \_bulk? I'm sure the answer depends on size of docs and specs of my server,  
> but do you have any kind of guidelines on what would constitute a  
> ridiculously huge payload?
> 
> Steve
> 
> Clinton Gormley wrote:
> 
> > On Wed, 2011-01-05 at 14:31 +0200, Shay Banon wrote:
> > 
> > > There should also be the actual json document to index, in another new  
> > > line, and then a new line to end it all.
> > 
> > oh yes 🙂
> > 
> > > On Wed, Jan 5, 2011 at 1:44 PM, Clinton Gormley  
> > > [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:
> > > 
> > > ```
> > > > curl -XPUT 'http://localhost:9200/_bulk' -d '{ "index" :
> > > { "_index" :
> > > > "test", "_type" : "type1", "_id" : "1" } }'
> > > 
> > > You're missing the final newline. Try this instead:
> > > 
> > > curl -XPUT 'http://localhost:9200/_bulk' -d '
> > > { "index" : { "_index" :"test", "_type" : "type1", "_id" :
> > > "1" } }
> > > '
> > > 
> > > clint
> > > 
> > > ```
> > 
> > --  
> > Web Announcements Limited is a company registered in England and Wales,  
> > with company number 05608868, with registered address at 10 Arvon Road,  
> > London, N5 1PR.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Problem-bulk-indexing-tp2194866p2199824.html](http://elasticsearch-users.115913.n3.nabble.com/Problem-bulk-indexing-tp2194866p2199824.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

### Author: ![michaelvalasanyan](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@michaelvalasanyan](https://discuss.elastic.co/u/michaelvalasanyan)
#### Post date: [July 14, 2011, 12:50pm UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/7 "2011-07-14T12:50:46Z")

</div>

Can you please tell me what's wrong with this one:  
curl -X PUT "[http://localhost:9200/\_bulk](http://localhost:9200/_bulk)" -d '{ "index" : { "\_index" : "profusion\_db", "\_type" : "service\_index", "\_id" : "1" } }  
{ "field1" : "value1" }  
'

---

<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 6, 2017, 4:00am UTC](https://discuss.elastic.co/t/problem-bulk-indexing/3742/8 "2017-07-06T04:00:40Z")

</div>


