# Does Java High Level REST Client have "check if exists" operation?

**URL:** <https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178>\
**Category:** Elasticsearch\
**Created:** [October 17, 2017, 5:43am UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178 "2017-10-17T05:43:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![k-miras](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/k-miras/32/23136_2.png) [@k-miras](https://discuss.elastic.co/u/k-miras)\
**Post date:** [October 17, 2017, 5:43am UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/1 "2017-10-17T05:43:52Z")

</div>

I'm using Get API for now but I think this is inefficient

---

<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:** [October 17, 2017, 6:05am UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/2 "2017-10-17T06:05:26Z")

</div>

Why do you think that?

---

<div class="post-metadata">

**Author:** ![k-miras](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/k-miras/32/23136_2.png) [@k-miras](https://discuss.elastic.co/u/k-miras)\
**Post date:** [October 17, 2017, 6:34am UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/3 "2017-10-17T06:34:52Z")

</div>

Oh,sorry,I've made a typo. I'm using Search API for now. But if I will use Get API it will change a structure of my code because I have used HEAD requests to check if exists

---

<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:** [October 17, 2017, 9:16am UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/4 "2017-10-17T09:16:19Z")

</div>

Can you explain what exactly is the problem if you still have a problem?

---

<div class="post-metadata">

**Author:** ![k-miras](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/k-miras/32/23136_2.png) [@k-miras](https://discuss.elastic.co/u/k-miras)\
**Post date:** [October 17, 2017, 9:07pm UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/5 "2017-10-17T21:07:38Z")

</div>

The problem is that when I use the Low Level Rest Client I'm retrieving data I check if record exists then another layer of program actually gets the record and, when I was rewriting my program to High Level Client, I realize that I'm getting record(with Get API) two times and it might be inefficient usage of network

---

<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:** [October 17, 2017, 9:21pm UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/6 "2017-10-17T21:21:11Z")

</div>

> when I was rewriting my program to High Level Client, I realize that I'm getting record(with Get API) two times

Why this? Just call the GET API once.

---

<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:** [November 14, 2017, 9:21pm UTC](https://discuss.elastic.co/t/does-java-high-level-rest-client-have-check-if-exists-operation/104178/7 "2017-11-14T21:21:37Z")

</div>

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