Hi;
The situation here is that I was trying to map some types into "parent-child" relationship.
When I use this command below, it works fine:
curl -XPOST 'http://localhost:9200/grandchildren' -d '{
"mappings" : {
"parent" : {
"properties" : {
"parent-name" : {
"type" : "string"
}
}
},
"child" : {
"_parent" : {
"type" : "parent"
},
"_routing" : {
"required" : true
},
"properties" : {
"child-name" : {
"type" : "string"
}
}
},
"child2" : {
"_parent" : {
"type" : "parent"
},
"_routing" : {
"required" : true
},
"properties" : {
"child2-name" : {
"type" : "string"
}
}
}
}
}'
However, when I build the "parent" first, and then the "child", this cannot be done:
curl -XPUT 'http://localhost:9200/grandchildren/parent/_mapping' -d '{
"parent" : {
"properties" : {
"parent-name" : {
"type" : "string"
}
}
}
}'
curl -XPUT 'http://localhost:9200/grandchildren/child/_mapping' -d '{
"child": {
"_parent": {
"type": "parent"
},
"_routing": {
"required": true
},
"properties": {
"child-name": {
"type": "string"
}
}
}
}'
curl -XPUT 'http://localhost:9200/grandchildren/child2/_mapping' -d '{
"child2": {
"_parent": {
"type": "parent"
},
"_routing": {
"required": true
},
"properties": {
"child2-name": {
"type": "string"
}
}
}
}'
Cause I believe that in some situations there would be a need of adding a "child" type after I set up a "parent-child" relationship of some types.
Of course I saw that in ES guide it said "Parent and child documents must be indexed on the same shard.", which means they should first appear in the mapping sentence all together. But I searched on the internet, knowing some company can add new "child" after the "parent-child" is already build. I don't know if they are bluffing..I guess the best way to find out is to ask question on ES forum.
**_
Hi, guys, when I create an index with only one shard, the "parent" and "child" can be created independently, half successful. But the data is huge, the efficiency of "one shard" index is quite low. Is there a way to sovle this problem?
_**
It would be great if someone can help me out!
Cheers,
Feiran