Problem with nested objects

Hi All,

I am using the following json for a document having multiple parents and
each parent having multiple childs . Is there any way to get child ids for
a single parent id?

I can able to get parent ids and child ids separately. But I am in need of
child ids corresponding to the parent . Can anyone help?

"tag":{
"type" : "nested", "store" : "yes", "index" : "not_analyzed", "omit_norms"
: "true",
"include_in_parent":true,
"properties":{
"parentid":{"type" : "integer", "store" : "yes", "precision_step" : "8" },
"childtag":{
"type" : "nested", "store" : "yes", "index" : "not_analyzed",
"omit_norms" : "true",
"include_in_parent":true,
"properties":{
"childid":{"type" : "integer", "store" : "yes", "precision_step" : "8" }
}
}
}
}

Please correct me if I am wrong. Thanks in advance!

Regards,
Thanuja

By using parent child relationship you can.

Ex:{
"query": {

"has_child": {
  "type": "TYPE",
  "query": {
    "match": {
      "FIELD": "TEXT"
    }
  }
}

}
}