Client.prepareGet() vs client.get()


(dawi) #1

Hi together,

the interface org.elasticsearch.client.Client provides methods to execute
requests (e.g. index(), delete(), get(), ...) and it also provides prepare
methods which return builder instances which can be used to build and
execute requests.

My question is which of both is the prefered way?
What for example is the main difference between:

client.prepareGet().setIndex(index).setId("123").execute().actionGet();
client.get(Requests.getRequest(index).id("123")).actionGet();

Or is it just a matter of taste?

Regards, Daniel


(Shay Banon) #2

Taste. Historically, the "get" was first introduced, and then the
prepareGet was added.

On Tue, Dec 20, 2011 at 11:12 PM, dawi d.wilmer.1980@googlemail.com wrote:

Hi together,

the interface org.elasticsearch.client.Client provides methods to execute
requests (e.g. index(), delete(), get(), ...) and it also provides prepare
methods which return builder instances which can be used to build and
execute requests.

My question is which of both is the prefered way?
What for example is the main difference between:

client.prepareGet().setIndex(index).setId("123").execute().actionGet();
client.get(Requests.getRequest(index).id("123")).actionGet();

Or is it just a matter of taste?

Regards, Daniel


(dawi) #3

Ok, thanks, for the info.


(system) #4