You should check out the IndexRequestBuilder class. It helps simplify
creating indexing requests and has a setId() method.
On Friday, July 25, 2014 4:22:42 PM UTC-7, Chia-Eng Chang wrote:
>
> I want to ask if the unique field _id be assigned by certain field within
> document. I see with Rest, it can achieve by "path":
>
> {
> "tweet" : {
> "_id" : {
> "path" : "post_id"
> }
> }
> }
>
> But if I want to do it with java API, is there any way to achieve it?
>
> Map<String, Object> MapA= new HashMap<String, Object>();
> MapA=MapProcessor(MapA);
>
> client.prepareIndex("index","type").setSource(MapA).execute().actionGet();
>
> How could I modify my code to assign certain field in Map to become _id of
> this type?
>
--
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/66966b06-71dc-4ff9-a863-4371bf9ca368%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.