Hi,
I am happy that you like elasticsearch so far :). Regarding the client,
there is a different between the TransportClient and the Service#client(). I
think that you would like to use the Server#client() if you want want auto
discovery and "one hope" (for example, when indexing, directly go to the
node to index, and not to an arbitrary node which will redirect it to the
correct node). When using Server#client(), make sure you set the node.data
setting to "false" if you don't want that server to participate in the
allocation of shards (data).
Regarding the source files, yea, its kindda of a pain to do it with
gradle currently. Though I am currently leaning toward simply including the
source in the jar file. Its simple, clean and no extra place to look for
sources. The problem is that it means bigger jar file.
Dependencies: If you are using the Server#client(), then most of the
dependencies are required. This is because that server can potentially hold
data (so the lucene jars are required, jgroups for discovery, and so on). In
theory, the Transport client should only need the netty/joda/jackson jar
files, but I have not tested it... . Is there a reason that you are
concerned about the jar files? The benefits of running in the
Server#client() mode far out-weight that extra jar files, imo.
Any Client (TransportClient or Server#client) are built to be reused from
several threads. In fact, they would start to get pretty upset if not used
from several threads as they are probably not fully utilizing elasticsearch
(elasticsearch is highly concurrent). Note also the full async API that you
get with them.
-shay.banon
On Mon, Mar 22, 2010 at 4:37 PM, Joerg Erdmenger joerge@gmail.com wrote:
Hi everybody,
I'm experimeting with elasticsearch and I like it a lot so far.
I have a question concerning the packaging though: I'd like to use
elasticsearch from a webapp and the Java API would serve me well there I
think - but it feels a bit wasteful to pull in all of elasticsearche's
classes plus all of the dependencies just to use
the org.elasticsearch.client.transport.TransportClient. Would it be possible
to have a client artifact with just the minimum dependencies? Or would you
advise on just creating my own client using the REST API? If I understand
correctly it means I lose the autodiscovery of the nodes in the cluster.
On a related note: Is it safe to reuse instances of the TransportClient?
Thanks for the great project
Jörg
P.S.: It would also be useful to have gradle generate and install a sources
artifact when running 'gradle elasticsearch:install' - but it seems there is
a bug in gradle 0.8 preventing that? (I'm not much of a gradle expert yet)