# How to use the http HEAD method in elastic search java api

**URL:** <https://discuss.elastic.co/t/how-to-use-the-http-head-method-in-elastic-search-java-api/19912>\
**Category:** Elasticsearch\
**Created:** [September 22, 2014, 12:39pm UTC](https://discuss.elastic.co/t/how-to-use-the-http-head-method-in-elastic-search-java-api/19912 "2014-09-22T12:39:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinod\_Joseph](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@Vinod\_Joseph](https://discuss.elastic.co/u/Vinod_Joseph)\
**Post date:** [September 22, 2014, 12:39pm UTC](https://discuss.elastic.co/t/how-to-use-the-http-head-method-in-elastic-search-java-api/19912/1 "2014-09-22T12:39:02Z")

</div>

Hi,

```
   I am writing a program using elastic search java api which inserts 

```

the JSON documents into elastic search. Insertions are successful but  
indexing is done the number of times I execute the program. Is there any  
way to avoid this repetitive indexing. I saw that we can use HEAD method in  
CURL but is there any way to use HEAD in java api. Please suggest me.

Thanks  
vinod

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/75b5b974-c5c5-4af5-8862-4fbc1751ec0e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/75b5b974-c5c5-4af5-8862-4fbc1751ec0e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [September 22, 2014, 2:53pm UTC](https://discuss.elastic.co/t/how-to-use-the-http-head-method-in-elastic-search-java-api/19912/2 "2014-09-22T14:53:00Z")

</div>

Not sure what program you write, but the HEAD in HTTP API uses a Java  
GetRequest under the hood, it just suppresses the return of any data in the  
response.

So, in Java, you should use the Java GetRequest.

Jörg

On Mon, Sep 22, 2014 at 2:39 PM, Vinod Joseph [vinodjoseph91@gmail.com](mailto:vinodjoseph91@gmail.com)  
wrote:

> Hi,
> 
> ```
> I am writing a program using elastic search java api which inserts
> 
> ```
> 
> the JSON documents into Elasticsearch. Insertions are successful but  
> indexing is done the number of times I execute the program. Is there any  
> way to avoid this repetitive indexing. I saw that we can use HEAD method in  
> CURL but is there any way to use HEAD in java api. Please suggest me.
> 
> Thanks  
> vinod
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/75b5b974-c5c5-4af5-8862-4fbc1751ec0e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/75b5b974-c5c5-4af5-8862-4fbc1751ec0e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/75b5b974-c5c5-4af5-8862-4fbc1751ec0e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/75b5b974-c5c5-4af5-8862-4fbc1751ec0e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFKGeAGEhYwM9JhH6hS%3Df%3D8XRvmpQ8b6\_SM\_Q-uZYwG7A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFKGeAGEhYwM9JhH6hS%3Df%3D8XRvmpQ8b6_SM_Q-uZYwG7A%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:00am UTC](https://discuss.elastic.co/t/how-to-use-the-http-head-method-in-elastic-search-java-api/19912/3 "2017-07-06T01:00:39Z")

</div>


