# Java api client example for rollover

**URL:** <https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131>\
**Category:** Elasticsearch\
**Created:** [March 26, 2024, 12:04am UTC](https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131 "2024-03-26T00:04:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [March 26, 2024, 12:04am UTC](https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131/1 "2024-03-26T00:04:04Z")

</div>

Is there a centralized place with examples of how java API clients are being invoked?  
It seems to be very lacking even after several years deprecating the old REST client.

I am trying to figure out how to issue rollover API in JAVA. Any pointers?

---

<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 26, 2024, 5:14am UTC](https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131/2 "2024-03-26T05:14:44Z")

</div>

I don't have yet this one specifically but some resources here:

> <https://github.com/dadoonet/elasticsearch-java-client-demo/blob/main/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java>

> **[Switching from the Java High Level Rest Client to the new Java API Client](https://www.elastic.co/blog/switching-from-the-java-high-level-rest-client-to-the-new-java-api-client)**
>
> Let's say you have a Java project using Elastic 7.17 and the deprecated High Level Rest Client (HLRC). You have been asked to switch to Elastic 8.11 but the HLRC does not exist for this version. This ...

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [March 26, 2024, 9:19pm UTC](https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131/3 "2024-03-26T21:19:22Z")

</div>

Do you have an example of bulkIndex with script?

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [March 26, 2024, 11:06pm UTC](https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131/4 "2024-03-26T23:06:34Z")

</div>

Also how to check if a document exists?  
I can find code that does check if an index exists, but not for a document via \_id.

version 8.10.2

Never mind. found the solutions.

exist = ES.exists(e -\> e  
.index(index)  
.id(docId)).value();

---

<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:** [April 23, 2024, 11:07pm UTC](https://discuss.elastic.co/t/java-api-client-example-for-rollover/356131/5 "2024-04-23T23:07:25Z")

</div>

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