Reputation: 2936
What is the difference between elastic search get vs action get?
Is it just that one exposes the exceptions where as the other one handles them itself?
All the usage examples with elastic search that I see (in Java) use actionGet, i.e
SearchResponse response = client.prepareSearch().execute().actionGet();
Which one should I be using and when?
Upvotes: 1
Views: 1803
Reputation: 16345
FromThe official javaDocs of actionGet()
Similar to {@link #get()}, just catching the {@link InterruptedException} and throwing * an {@link org.elasticsearch.ElasticsearchIllegalStateException} instead. Also catches * {@link java.util.concurrent.ExecutionException} and throws the actual cause instead.
It just provides a wrapper over Future#get()
, catches InterruptedException, ExecutionException
and wraps them into ElasticSearchException
Also, you can directly use client.prepareSearch().get()
instead of client.prepareSearch().execute().actionGet()
. It internally does the same.
Upvotes: 2