The behavior is applied at the creation of the index within the mapping,
not during the prepareIndex call. The example you provided is part of the
mapping and not part of the document that gets indexed. If you want to
override which field will be used as the _id field, you would need to
change your mapping.
Cheers,
Ivan
On Sun, Jul 27, 2014 at 11:09 AM, Kireet Reddy kireet@feedly.com wrote:
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?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.