# Rest vs Java/Groovy Api

**URL:** <https://discuss.elastic.co/t/rest-vs-java-groovy-api/5478>\
**Category:** Elasticsearch\
**Created:** [September 29, 2011, 2:32pm UTC](https://discuss.elastic.co/t/rest-vs-java-groovy-api/5478 "2011-09-29T14:32:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit\_Anchlia](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mohit\_Anchlia](https://discuss.elastic.co/u/Mohit_Anchlia)\
**Post date:** [September 29, 2011, 2:32pm UTC](https://discuss.elastic.co/t/rest-vs-java-groovy-api/5478/1 "2011-09-29T14:32:22Z")

</div>

Is there a performance benefit of using one Api over the other.

As I understand for Java Api Unit testing we could start a node and  
perform operations against it. But is there a similar thing that can  
be used for Rest?

---

<div class="post-metadata">

**Author:** ![Frederic](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@Frederic](https://discuss.elastic.co/u/Frederic)\
**Post date:** [September 30, 2011, 1:02pm UTC](https://discuss.elastic.co/t/rest-vs-java-groovy-api/5478/2 "2011-09-30T13:02:22Z")

</div>

I don't know about performance, and of course ES coders will answser  
this better than me but, for testing:

Fore sure you should be able to perform integration tests, starting up  
ES manually and hitting localhost:9200 from your code using any Rest  
client.

Regarding Unit Testing, I assume you will need to use the API at least  
for creating and starting a node which, if no other instance of ES is  
running at that time, will run on the 9200 port. Then you can run you  
unit tests like integration ones, using you http client and pure REST/  
JSON requests.

Apart from testing, from my point of view, one the benefits of using  
the Java API is that you have builders for every piece of every  
possible query, so ,in case you don't perform hard-coded queries, I  
would recommend using the Java API because otherwise you most likely  
will end up coding your own modules for building the final JSON.

Hope it helps,

On 29 sep, 11:32, Mohit Anchlia [mohitanch...@gmail.com](mailto:mohitanch...@gmail.com) wrote:

> Is there a performance benefit of using one Api over the other.
> 
> As I understand for Java Api Unit testing we could start a node and  
> perform operations against it. But is there a similar thing that can  
> be used for Rest?

---

<div class="post-metadata">

**Author:** ![Mohit\_Anchlia](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mohit\_Anchlia](https://discuss.elastic.co/u/Mohit_Anchlia)\
**Post date:** [September 30, 2011, 1:55pm UTC](https://discuss.elastic.co/t/rest-vs-java-groovy-api/5478/3 "2011-09-30T13:55:56Z")

</div>

Thanks for the input.

On Fri, Sep 30, 2011 at 6:02 AM, Frederic [focampo.br@gmail.com](mailto:focampo.br@gmail.com) wrote:

> I don't know about performance, and of course ES coders will answser  
> this better than me but, for testing:
> 
> Fore sure you should be able to perform integration tests, starting up  
> ES manually and hitting localhost:9200 from your code using any Rest  
> client.
> 
> Regarding Unit Testing, I assume you will need to use the API at least  
> for creating and starting a node which, if no other instance of ES is  
> running at that time, will run on the 9200 port. Then you can run you  
> unit tests like integration ones, using you http client and pure REST/  
> JSON requests.
> 
> Apart from testing, from my point of view, one the benefits of using  
> the Java API is that you have builders for every piece of every  
> possible query, so ,in case you don't perform hard-coded queries, I  
> would recommend using the Java API because otherwise you most likely  
> will end up coding your own modules for building the final JSON.
> 
> Hope it helps,
> 
> On 29 sep, 11:32, Mohit Anchlia [mohitanch...@gmail.com](mailto:mohitanch...@gmail.com) wrote:
> 
> > Is there a performance benefit of using one Api over the other.
> > 
> > As I understand for Java Api Unit testing we could start a node and  
> > perform operations against it. But is there a similar thing that can  
> > be used for Rest?

---

<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, 3:53am UTC](https://discuss.elastic.co/t/rest-vs-java-groovy-api/5478/4 "2017-07-06T03:53:15Z")

</div>


