Difference between .index() and .prepareIndex()

Hi guys,

whats the differences between these both calls. Is the first one a newer
approach:

final IndexResponse response =
this.esClient.prepareIndex(index,type).setSource(source).execute().actionGet();

and...

final IndexRequest request = new IndexRequest(index,type).source(source);
final IndexResponse response = this.esClient.index(request).actionGet();

Regards,
Alex

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

There is no difference when it comes to code execution, it is just that ES
has more than one API style.

prepareIndex() uses an IndexRequestBuilder behind the scenes, and follows a
kind of a "fluent interface" with a builder pattern

A more verbose example of prepareIndex() would be
client.prepareIndex().setIndex(index).setType(type).setId(id).setSource(source).execute().actionGet()

Jörg

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.