Rest vs Java/Groovy Api


(Mohit Anchlia) #1

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?


(Frederic) #2

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 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?


(Mohit Anchlia) #3

Thanks for the input.

On Fri, Sep 30, 2011 at 6:02 AM, Frederic 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 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?


(system) #4