# Java-api Bulk indexing

**URL:** <https://discuss.elastic.co/t/java-api-bulk-indexing/4087>\
**Category:** Elasticsearch\
**Created:** [March 13, 2011, 11:33am UTC](https://discuss.elastic.co/t/java-api-bulk-indexing/4087 "2011-03-13T11:33:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![K\_B](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@K\_B](https://discuss.elastic.co/u/K_B)\
**Post date:** [March 13, 2011, 11:33am UTC](https://discuss.elastic.co/t/java-api-bulk-indexing/4087/1 "2011-03-13T11:33:04Z")

</div>

Hello,

I try to use the a bulk operation to index data with the java api, but  
allways get Excpetions; As it's not explained in guide I wanted to  
kindly ask how it's done correctly.

I tried this way: [https://gist.github.com/dd8c43718c7a462f4ab1](https://gist.github.com/dd8c43718c7a462f4ab1)

any help warmly welcome 🙂

---

<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:** [March 14, 2011, 9:52am UTC](https://discuss.elastic.co/t/java-api-bulk-indexing/4087/2 "2011-03-14T09:52:24Z")

</div>

I am missing the actual exception of the failed bulk execution. But, it seems like you are missing to set the type on the IndexRequest.  
On Sunday, March 13, 2011 at 1:33 PM, K.B. wrote:

> Hello,
> 
> I try to use the a bulk operation to index data with the java api, but  
> allways get Excpetions; As it's not explained in guide I wanted to  
> kindly ask how it's done correctly.
> 
> I tried this way: [Java-Code · GitHub](https://gist.github.com/dd8c43718c7a462f4ab1)
> 
> any help warmly welcome 🙂

---

<div class="post-metadata">

**Author:** ![K\_B](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@K\_B](https://discuss.elastic.co/u/K_B)\
**Post date:** [March 14, 2011, 10:35am UTC](https://discuss.elastic.co/t/java-api-bulk-indexing/4087/3 "2011-03-14T10:35:25Z")

</div>

Hey Shay,

thank you very much! - it was indeed the missing .type(type)! Now as I  
can use Bulk vs. indivial requests the time needed to index my 1400  
big objects went down from 3.0s/ 2.0s (initial/ db-warmed-up) to only  
1.599s/ 0.6 s (initial/ db-warmed-up) time for a complete drop and  
reindex of all objects!

Its really cool to see how blazing fast this is 🙂

Best,

Korbinian

PS: I'd like toadd this to the manual in the java-api section - does  
this mean I have to fork the [https://github.com/elasticsearch/elasticsearch.github.com](https://github.com/elasticsearch/elasticsearch.github.com),  
update the doc's and then send a pull-request?

On 14 Mrz., 10:52, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> I am missing the actual exception of the failed bulk execution. But, it seems like you are missing to set the type on the IndexRequest.
> 
> On Sunday, March 13, 2011 at 1:33 PM, K.B. wrote:
> 
> > Hello,
> 
> > I try to use the a bulk operation to index data with the java api, but  
> > allways get Excpetions; As it's not explained in guide I wanted to  
> > kindly ask how it's done correctly.
> 
> > I tried this way:[Java-Code · GitHub](https://gist.github.com/dd8c43718c7a462f4ab1)
> 
> > any help warmly welcome 🙂

---

<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:** [March 14, 2011, 10:56am UTC](https://discuss.elastic.co/t/java-api-bulk-indexing/4087/4 "2011-03-14T10:56:28Z")

</div>

On Monday, March 14, 2011 at 12:35 PM, K.B. wrote:  
Hey Shay,

> thank you very much! - it was indeed the missing .type(type)! Now as I  
> can use Bulk vs. indivial requests the time needed to index my 1400  
> big objects went down from 3.0s/ 2.0s (initial/ db-warmed-up) to only  
> 1.599s/ 0.6 s (initial/ db-warmed-up) time for a complete drop and  
> reindex of all objects!
> 
> Its really cool to see how blazing fast this is 🙂  
> cool! :). Its usually gets faster as things warm up.
> 
> Best,
> 
> Korbinian
> 
> PS: I'd like toadd this to the manual in the java-api section - does  
> this mean I have to fork the [https://github.com/elasticsearch/elasticsearch.github.com](https://github.com/elasticsearch/elasticsearch.github.com),  
> update the doc's and then send a pull-request?  
> Yep.
> 
> On 14 Mrz., 10:52, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > I am missing the actual exception of the failed bulk execution. But, it seems like you are missing to set the type on the IndexRequest.
> > 
> > On Sunday, March 13, 2011 at 1:33 PM, K.B. wrote:
> > 
> > > Hello,
> > 
> > > I try to use the a bulk operation to index data with the java api, but  
> > > allways get Excpetions; As it's not explained in guide I wanted to  
> > > kindly ask how it's done correctly.
> > 
> > > I tried this way:[Java-Code · GitHub](https://gist.github.com/dd8c43718c7a462f4ab1)
> > 
> > > any help warmly welcome 🙂

---

<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:10am UTC](https://discuss.elastic.co/t/java-api-bulk-indexing/4087/5 "2017-07-06T04:10:07Z")

</div>


