Hi all,
I followed the guide here : http://www.elasticsearch.org/guide/reference/mapping/routing-field.html and successfully created my own index
However, when I try to insert a document into the index, I got this error message "MapperParsingException[External routing [sammy] and document path routing [null] mismatch]". I've tried everything to make it work but there's still no hope . Could you please take a look in my requests for the APIs and give me some advice?
CREATE INDEX
{
"settings":{
"index":{
"number_of_shards" : 10,
"number_of_replicas": 1
}
},
"mappings":{
"user":{
"_source" : {"enabled" : false},
"_routing": {
"required" : true,
"path" : "user.username"
},
"properties":{
"name" : {
"type" : "object",
"properties" : {
"first_name" : {"type": "string"},
"last_name" : {"type": "string"}
}
},
"username" : {"type" : "string", "boost" : 1.2},
"email": {"type": "string"}
}
},
"item":{
"_source" : {"enabled" : false},
"_parent" : { "type" : "user"},
"_routing" : {
"required" : true,
"path" : "item.owner"
},
"_timestamp" : {
"enabled" : true,
"format" : "MM-dd-yyyy hh:mm:ss"
},
"_ttl" : {"enabled" : true, "default" : "3d"},
"properties":{
"id" : {"type" : "string", "path" : "item._timestamp"},
"name": {"type": "string", "boost" : 1.4},
"price": {"type": "float"},
"type" : {"type": "string"},
"postDate" : {"type" : "date", "format" : "MM-dd-yyyy"},
"owner" : {"type": "string", "boost" : 1.2},
"message" : {"type" : "string", "index" : "analyzed", "null_value" : "na"}
}
}
}
}
INSERT DOCUMENT
curl -XPUT 'http://localhost:9200/ecommerce/user?routing=sammy&pretty=true -d '{
"name" : {
"first_name": "sam",
"last_name" : "Vo"
},
"username" : "sammy",
"email" : "sammy@abc.com"
}
Regards,
Sam Vo