# Problem with Bulk Indexing

**URL:** <https://discuss.elastic.co/t/problem-with-bulk-indexing/4295>\
**Category:** Elasticsearch\
**Created:** [April 26, 2011, 12:34pm UTC](https://discuss.elastic.co/t/problem-with-bulk-indexing/4295 "2011-04-26T12:34:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nir\_Rubinstein](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@Nir\_Rubinstein](https://discuss.elastic.co/u/Nir_Rubinstein)\
**Post date:** [April 26, 2011, 12:34pm UTC](https://discuss.elastic.co/t/problem-with-bulk-indexing/4295/1 "2011-04-26T12:34:51Z")

</div>

Hello

I'm very new to ES and I'm trying to come to terms with a problem that  
I have. I've installed ES on my local machine (Windows 7) and have it  
running. I'm using .NET to send basic http command to ES on port 9200.  
I can index single records without any problem, but when I try to  
index multiple documents at once, I encounter a problem.

I send a "PUT" request to [http://localhost/bulk](http://localhost/bulk) and transfer it a json  
document as shown in the example on the ES site (on a side note, the  
site states to use the "\_bulk" uri while I use "bulk" because the  
former doesn't yield any results). I receive a 200 response with a  
json result of {"ok":true,"acknowledged":true}

Every bulk command I send hereafter get a 400 "Bad Request" status  
back (even though the singular index commands work as usual). What am  
I missing - is there an action I need to do after sending this bulk  
doc?

Any help will be greatly appreciated

---

<div class="post-metadata">

**Author:** ![Nir\_Rubinstein](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@Nir\_Rubinstein](https://discuss.elastic.co/u/Nir_Rubinstein)\
**Post date:** [April 26, 2011, 12:41pm UTC](https://discuss.elastic.co/t/problem-with-bulk-indexing/4295/2 "2011-04-26T12:41:15Z")

</div>

Ok, found my first mistake - using the "bulk" uri is a mistake because  
it creates an index named "bulk". I tried "PUT"ing the json document  
to [http://localhost:9200/\_bulk](http://localhost:9200/_bulk) but got a 500 response in return. The  
body of the document is:

{ "index" : { "\_index" : "test", "type" : "type1", "\_id" : "3" } }  
\n{ "field1" : "value2" }

notice the "\n" used to separate the metadata from the data (as shown  
on the site). This is a bulk index of only 1 record, but I still can't  
get it to work.  
Again, any help will be welcomed!

Thanks!

On Apr 26, 3:34 pm, Nir Rubinstein [nir...@gmail.com](mailto:nir...@gmail.com) wrote:

> Hello
> 
> I'm very new to ES and I'm trying to come to terms with a problem that  
> I have. I've installed ES on my local machine (Windows 7) and have it  
> running. I'm using .NET to send basic http command to ES on port 9200.  
> I can index single records without any problem, but when I try to  
> index multiple documents at once, I encounter a problem.
> 
> I send a "PUT" request tohttp://localhost/bulkand transfer it a json  
> document as shown in the example on the ES site (on a side note, the  
> site states to use the "\_bulk" uri while I use "bulk" because the  
> former doesn't yield any results). I receive a 200 response with a  
> json result of {"ok":true,"acknowledged":true}
> 
> Every bulk command I send hereafter get a 400 "Bad Request" status  
> back (even though the singular index commands work as usual). What am  
> I missing - is there an action I need to do after sending this bulk  
> doc?
> 
> Any help will be greatly appreciated

---

<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:** [April 26, 2011, 12:45pm UTC](https://discuss.elastic.co/t/problem-with-bulk-indexing/4295/3 "2011-04-26T12:45:01Z")

</div>

Hi Nir

> I send a "PUT" request to [http://localhost/bulk](http://localhost/bulk) and transfer it a json  
> document as shown in the example on the ES site (on a side note, the  
> site states to use the "\_bulk" uri while I use "bulk" because the  
> former doesn't yield any results).

You can't change the URI from '\_bulk' to 'bulk' - it changes the meaning  
completely: ie use index 'bulk' instead of action '\_bulk'

So the question is why your original request (which does use '\_bulk')  
doesn't work.

You haven't provided any example of what you are actually doing (see  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help) ) but perhaps you're missing the final  
newline at the end of your request.

clint

---

<div class="post-metadata">

**Author:** ![Nir\_Rubinstein](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@Nir\_Rubinstein](https://discuss.elastic.co/u/Nir_Rubinstein)\
**Post date:** [April 26, 2011, 12:48pm UTC](https://discuss.elastic.co/t/problem-with-bulk-indexing/4295/4 "2011-04-26T12:48:23Z")

</div>

Yup - saw my mistake - see my post above. I also tried adding a "\n"  
at the end of the json document to the same effect.

Thanks again

On Apr 26, 3:45 pm, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> Hi Nir
> 
> > I send a "PUT" request tohttp://localhost/bulkand transfer it a json  
> > document as shown in the example on the ES site (on a side note, the  
> > site states to use the "\_bulk" uri while I use "bulk" because the  
> > former doesn't yield any results).
> 
> You can't change the URI from '\_bulk' to 'bulk' - it changes the meaning  
> completely: ie use index 'bulk' instead of action '\_bulk'
> 
> So the question is why your original request (which does use '\_bulk')  
> doesn't work.
> 
> You haven't provided any example of what you are actually doing (seehttp://www.elasticsearch.org/help) but perhaps you're missing the final  
> newline at the end of your request.
> 
> clint

---

<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:07am UTC](https://discuss.elastic.co/t/problem-with-bulk-indexing/4295/5 "2017-07-06T04:07:40Z")

</div>


