# Bulk index w/ new java-client

**URL:** https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [March 19, 2022, 8:50pm UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111 "2022-03-19T20:50:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![divadpoc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divadpoc/32/97844_2.png) [@divadpoc](https://discuss.elastic.co/u/divadpoc)
#### Post date: [March 19, 2022, 8:50pm UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/1 "2022-03-19T20:50:12Z")

</div>

Hi, I'm looking for an example of how to do a bulk insert w/ the new java-client (8.1).

Previously (w/ ES 7) I used the high level rest client and a `BulkProcessor` .

Thanks

---

<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: [March 20, 2022, 10:34am UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/2 "2022-03-20T10:34:40Z")

</div>

The BulkProcessor has not been implemented yet in the new client but it will be soon.

Here's some code:

```auto
List<BulkOperation> operations = new ArrayList<>();
operations.add(new BulkOperation(IndexOperation.of(b -> b.index("person").id(person.idAsString()).document(person))));
esClient.bulk(br -> br.index("person").operations(operations));

```

The documentation will be improved in the future.

Here is also a useful class:

> <https://github.com/elastic/elasticsearch-java/blob/main/java-client/src/test/java/co/elastic/clients/elasticsearch/end_to_end/RequestTest.java>

---

<div class="post-metadata">

### Author: ![divadpoc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divadpoc/32/97844_2.png) [@divadpoc](https://discuss.elastic.co/u/divadpoc)
#### Post date: [March 21, 2022, 1:01pm UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/3 "2022-03-21T13:01:05Z")

</div>

Thank you for your time. I'll give it a try soon.  
So I see it's on the agenda - do you have an estimate timeline?  
Thanks again.

---

<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: [March 21, 2022, 2:01pm UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/4 "2022-03-21T14:01:39Z")

</div>

I don't. @swallez would probably know if there is a target for this.

---

<div class="post-metadata">

### Author: ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)
#### Post date: [March 21, 2022, 2:28pm UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/5 "2022-03-21T14:28:19Z")

</div>

We don't have an exact target but it's very high on the feature priority list. Important to note also that it will be backported to 7.17.

---

<div class="post-metadata">

### Author: ![Julian\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_3/32/103539_2.png) [@Julian\_3](https://discuss.elastic.co/u/Julian_3)
#### Post date: [March 25, 2022, 3:29pm UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/6 "2022-03-25T15:29:52Z")

</div>

only post ive found on this, thanks to the guys @elastic for the comments, Im also trying to implement the new java api over the old one with it being deprecated and the docs are non existent. to anyone else i would recommend using the old libs for the time being.

---

<div class="post-metadata">

### Author: ![divadpoc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divadpoc/32/97844_2.png) [@divadpoc](https://discuss.elastic.co/u/divadpoc)
#### Post date: [April 19, 2022, 8:51am UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/7 "2022-04-19T08:51:51Z")

</div>

I think [this is the issue](https://github.com/elastic/elasticsearch-java/issues/108) regarding the bulk processor topic - for anyone else stumbling upon this thread in the future

---

<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: [May 17, 2022, 8:52am UTC](https://discuss.elastic.co/t/bulk-index-w-new-java-client/300111/8 "2022-05-17T08:52:44Z")

</div>

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