Currently, my ES(5.6.3) mapping is like this:
Index:
Parent Type,
Child Type 1,
Child Type 2,
........
Child Type 70
Each Child Type has its own nested documents. Parent Type and Child Type have a common Key (ID). So, using has has_child or has_parent is very convenient.
With 1 type 1 index, they are 2 ways to convert it:
1. create total of 71 indexes with 1 type.
2. create a custom "type" field and lump all fields in each parent/child type into one type.(Very ugly, we are talking about 800 fields.)
My question is, with above 2 choices, how do you query for parent type if any child type has a matching?
Previously can be done in 1 query:
GET /index/parent type/_search
{
"size": 500,
"query": {
"bool": {
"should": [
{
"bool": {
"must": {
"has_child": {
"type": "child type 1",
"query": {
"match": {
"key": "xxxxx"
}
},
"inner_hits": {
"size": 500
}
}
}
}
},
{
"bool": {
"must": {
"has_child": {
"type": "Child type 2",
"query": {
"match": {
"key": "xxxxx"
}
},
"inner_hits": {
"size": 500
}
}
}
}
},
....
}
Also, how do you create a new Index for the Child Type(choice 1)? (Parent type is OK)
Using reindex API to reindex Child Type:
POST _reindex
{
"source": {
"index": "index",
"type": "child type 1"
},
"dest": {
"index": "child type 1"
}
}
I got:
"cause": {
"type": "illegal_argument_exception",
"reason": "can't specify parent if no parent field has been configured"
},
"status": 400
Anyone know how to reindex a child type? (Type with parent defined)
Thanks
This question was answered in the following post
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.