REST vs JAVA API

We are building a Spring based application which will eventually reside in
the cloud. I am confused if I should use REST or ES Java API to connect to
my ES cluster. I am inclined towards using REST, because (1) the
abstraction and flexibility which it provides (2) not sure how API will
perform in cloud for discovering new nodes (3) client connection will be
managed by Spring via RESTtemplate etc.I understand I will end up building
JSON string to be sent over REST, but I feel it still is a better approach.
Would greatly appreciate your thoughts on this. Thanks!!

One benefit of the Java API is that your client object is actually a
node that joins the cluster. You get automatically the internal routing
features and you don't have to handle joining/leaving of nodes.
If your deployment model handles externally discovery and query/index
routing then indeed the REST API may give you more flexibility.

Regards
Pavel

On 3.11.2011 11:31, achaayan wrote:

We are building a Spring based application which will eventually
reside in the cloud. I am confused if I should use REST or ES Java API
to connect to my ES cluster. I am inclined towards using REST, because
(1) the abstraction and flexibility which it provides (2) not sure how
API will perform in cloud for discovering new nodes (3) client
connection will be managed by Spring via RESTtemplate etc.I understand
I will end up building JSON string to be sent over REST, but I feel it
still is a better approach.
Would greatly appreciate your thoughts on this. Thanks!!

Thanks, Pavel.

Please correct me if I am wrong, but as per my understanding, the REST URL
will be hitting a node, and as this node will be aware of any additional
nodes joining / leaving the cluster. Hence, is there any benefits of using
the Java client node API ?

Hi,

If you use Java client node API then your requests will be directly routed
to the nodes that need to process your query, if you use REST over HTTP
then your requests will be typically rerouted to other nodes. Also when
using Java node client then the transport layer uses optimized protocol for
node communication which again HTTP does not provide. This means that Java
node client can provide you better performance. (Although I am not saying
that the best performance is what you always need, sometimes it is better
to prefer other options if they fits your overall system design).

Regards,
Lukas

On Thu, Nov 3, 2011 at 10:53 AM, achaayan felixmd@gmail.com wrote:

Thanks, Pavel.

Please correct me if I am wrong, but as per my understanding, the REST URL
will be hitting a node, and as this node will be aware of any additional
nodes joining / leaving the cluster. Hence, is there any benefits of using
the Java client node API ?

Thanks !!