Thanks. The code I'm developing will support both Node and Transport
clients. The selection will be configuration driven.
There must be a way to determine if a CRUD operation succeeded. For
example, see the following code taken from the Logstash Ruby client based
plugin. Is there any Java client equivalent?
def template_exists?(name)
@client.indices.get_template(:name => name)
return true
rescue Elasticsearch::Transport::Transport::Errors::NotFound
return false
end # def template_exists?
In addition, for transport client do you recommend checking
client.connectedNodes().size() > 0 ?
On Thursday, June 5, 2014 3:44:25 PM UTC+3, Jörg Prante wrote:
>
> Do you use TransportClient or NodeClient?
>
> On NodeClient, you are tied to the cluster, as the node is being a part of
> it, on TransportClient, you can count the connected nodes.
>
> The discovery mechanism behind the scenes sends "ping" actions each few
> seconds for you. If an action fails, you will see exceptions there. No need
> to ask explicitly the cluster for a state or something (your code also just
> asks for the local state copy which has nothing to do with testing
> connections)
>
> Jörg
>
>
> On Thu, Jun 5, 2014 at 1:29 PM, Nir Dothan <[email protected]
> <javascript:>> wrote:
>
>> I'm not sure how to handle errors when using the java client. How do I
>> grammatically know if my connection was successful, or if indexing of a
>> document succeeded?
>> In Rest we have the http result code, but in java, I did not see a
>> documented way to catch checked exceptions or anything like that.
>> For connection assurance I use:
>> return 0< client.admin().cluster().prepareState().get().getState().
>> getVersion();
>> Is that correct? is it effective?
>> Can anyone please refer my to any documentation or relevant source code?
>>
>> --
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/f98a54e0-efb0-47f8-a391-e2ec3920a3d1%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/elasticsearch/f98a54e0-efb0-47f8-a391-e2ec3920a3d1%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/5f4a13ee-25e2-40f4-8163-b19a718fa225%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.