# New Java API client BulkRequest lacks documentation/features

**URL:** <https://discuss.elastic.co/t/new-java-api-client-bulkrequest-lacks-documentation-features/304809>\
**Category:** Elasticsearch\
**Created:** [May 16, 2022, 11:01am UTC](https://discuss.elastic.co/t/new-java-api-client-bulkrequest-lacks-documentation-features/304809 "2022-05-16T11:01:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![frankmontyne](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@frankmontyne](https://discuss.elastic.co/u/frankmontyne)\
**Post date:** [May 16, 2022, 11:01am UTC](https://discuss.elastic.co/t/new-java-api-client-bulkrequest-lacks-documentation-features/304809/1 "2022-05-16T11:01:05Z")

</div>

Can somebody show me a more elaborate example of using the new Java API BulkRequest? I used to be able to set things like bulk size, bulk actions, concurrent requests,... I already took a look at [elasticsearch-java/RequestTest.java at main · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/blob/main/java-client/src/test/java/co/elastic/clients/elasticsearch/end_to_end/RequestTest.java#L209-L247) but there is nothing there that casts some light on the problem.  
One other problem, there seems to be no way to simply get the source (as a string) on the BulkResponseItem, BulkResponseItem.get().source() returns a Map\<String, JsonData). A bit cumbersome since we are using GSON and that means an extra conversion step.

---

<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:** [May 16, 2022, 12:49pm UTC](https://discuss.elastic.co/t/new-java-api-client-bulkrequest-lacks-documentation-features/304809/2 "2022-05-16T12:49:13Z")

</div>

If you meant the BulkProcessor, there is no yet a replacement for this helper class AFAIK. It's in the roadmap though.  
So for now, you need to do it manually.

I have an example here:

> <https://github.com/dadoonet/legacy-search/blob/06-fuzziness/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L115-L121>

> [@frankmontyne](#):
>
> One other problem, there seems to be no way to simply get the source (as a string) on the BulkResponseItem, BulkResponseItem.get().source() returns a Map\<String, JsonData). A bit cumbersome since we are using GSON and that means an extra conversion step.

Have a look at:

> <https://github.com/dadoonet/legacy-search/blob/cc83bad56667398ec9f4947460aff3a660896343/src/main/java/fr/pilato/demo/legacysearch/dao/ElasticsearchDao.java#L158-L164>

There is a pending PR to make that easier in the future.

> <https://github.com/elastic/elasticsearch-java/pull/213>
>
> This method \`serializeToString()\` helps to generate the json String representati…on of any response or request object.
> This could be useful for debugging or for other usages like consuming the search response objects within a JavaScript based frontend.

---

<div class="post-metadata">

**Author:** ![frankmontyne](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@frankmontyne](https://discuss.elastic.co/u/frankmontyne)\
**Post date:** [May 18, 2022, 12:55pm UTC](https://discuss.elastic.co/t/new-java-api-client-bulkrequest-lacks-documentation-features/304809/3 "2022-05-18T12:55:35Z")

</div>

Thanks for the question about the source. I'm basically doing the same at this point using GSON. I thought the source string was available though without going through a conversion step.

Weird decision on to remove the high level rest client from version 8 without a fully fleshed out new api.

---

<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:** [June 15, 2022, 12:55pm UTC](https://discuss.elastic.co/t/new-java-api-client-bulkrequest-lacks-documentation-features/304809/4 "2022-06-15T12:55:43Z")

</div>

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