Hi,
I'm trying to put the following mapping using the Java API :
{
"userprofile" : {
"_id" : {
"path" : "_mid"
},
"properties" : {
"_mid" : {
"type" : "string",
"store" : "yes",
"index" : "not_analyzed"
}
}
}
}
When checking what mapping is known server side I get :
mappings: {
userprofile: {
properties: {
_mid: {
index: not_analyzed
store: yes
type: string
}
}
}
}
There is no reference to the _id field ....
Here's how this is done in JAVA :
XContentBuilder mappingBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject("userprofile");
mappingBuilder.startObject("_id");
mappingBuilder.field("path", "_mid");
mappingBuilder.endObject();
mappingBuilder.startObject("properties");
mappingBuilder.startObject("_mid");
mappingBuilder.field("type", "string");
mappingBuilder.field("store", Store.yes);
mappingBuilder.field("index", Analyze.not_analyzed);
mappingBuilder.endObject();
getClient().admin().indices()
.preparePutMapping().setType("userprofile")
.setSource(mappingBuilder.string()).execute().actionGet();
getClient().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
What am I doing wrong ?
Why isn't the "_id" mapping taken into account ?
Thanks for your help.
Alex