# Does the new elasticsearch Java API client BulkOperation, BulkRequest, BulkResponse works similarly with HLRC BulkProcessor?

**URL:** https://discuss.elastic.co/t/does-the-new-elasticsearch-java-api-client-bulkoperation-bulkrequest-bulkresponse-works-similarly-with-hlrc-bulkprocessor/310356
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [July 22, 2022, 1:56am UTC](https://discuss.elastic.co/t/does-the-new-elasticsearch-java-api-client-bulkoperation-bulkrequest-bulkresponse-works-similarly-with-hlrc-bulkprocessor/310356 "2022-07-22T01:56:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ALX\_DM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alx_dm/32/106314_2.png) [@ALX\_DM](https://discuss.elastic.co/u/ALX_DM)
#### Post date: [July 22, 2022, 1:56am UTC](https://discuss.elastic.co/t/does-the-new-elasticsearch-java-api-client-bulkoperation-bulkrequest-bulkresponse-works-similarly-with-hlrc-bulkprocessor/310356/1 "2022-07-22T01:56:41Z")

</div>

It was said that there is no equivalent to HLRC `BulkProcessor` in the new elasticsearch Java API client BUT there are these `BulkOperation`, `BulkRequest`, `BulkResponse`...are they similar in a way?

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [July 22, 2022, 2:14am UTC](https://discuss.elastic.co/t/does-the-new-elasticsearch-java-api-client-bulkoperation-bulkrequest-bulkresponse-works-similarly-with-hlrc-bulkprocessor/310356/2 "2022-07-22T02:14:10Z")

</div>

Hi @ALX_DM .

I have an example that bulk where I read a list of documents in json file and create a bulkrequest to index in my index.

```auto
var in = getClass().getClassLoader().getResourceAsStream("dataset.json");
    var dataset = new String(ByteStreams.toByteArray(in), StandardCharsets.UTF_8);

    var objectMapper = new ObjectMapper();
    var movies = objectMapper.readValue(dataset, new TypeReference<List<Movie>>() {
    });

    BulkRequest.Builder br = new BulkRequest.Builder();
    movies.forEach(movie -> {
      br.operations(op -> op
          .index(idx -> idx
              .index("idx_test")
              .document(movie)
          )
      );
    });
    var response = client.bulk(br.build());

```

---

<div class="post-metadata">

### Author: ![ALX\_DM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alx_dm/32/106314_2.png) [@ALX\_DM](https://discuss.elastic.co/u/ALX_DM)
#### Post date: [July 22, 2022, 2:16am UTC](https://discuss.elastic.co/t/does-the-new-elasticsearch-java-api-client-bulkoperation-bulkrequest-bulkresponse-works-similarly-with-hlrc-bulkprocessor/310356/3 "2022-07-22T02:16:58Z")

</div>

@RabBit_BR

Thank you for this sample.

THis will indeed guide me in the right direction.

Very much appreciated.

---

<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 19, 2022, 2:17am UTC](https://discuss.elastic.co/t/does-the-new-elasticsearch-java-api-client-bulkoperation-bulkrequest-bulkresponse-works-similarly-with-hlrc-bulkprocessor/310356/4 "2022-08-19T02:17:27Z")

</div>

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