How to receive child docID on has_child query


(vineeth mohan) #1

Hi ,

I placed this query -

{
"query": {
"has_child": {
"type": "child",
"query": {
"term": {
"names": "srijith"
}
}
}
}
}

And recieved

{

  • took: 1
  • timed_out: false
  • _shards: {
    • total: 2
    • successful: 2
    • failed: 0
      }
  • hits: {
    • total: 1
    • max_score: 1
    • hits: [
      • {
        • _index: algotree
        • _type: parent
        • _id: aa8GhCZyRr6FjRigMF4GAQ
        • _score: 1
        • _source: {
          • names: algotree
            }
            }
            ]
            }

}

Here the result is fine , but i was expecting the child result to be
combined with the parent.
Or at-least it will help if i get child docID.
How can i do it ?

Thanks
Vineeth


(Shay Banon) #2

No, there ins't an option to get the child documents as part of the results. You only get the parents that matched.

On Monday, March 5, 2012 at 1:56 PM, Vineeth Mohan wrote:

Hi ,

I placed this query -

{
"query": {
"has_child": {
"type": "child",
"query": {
"term": {
"names": "srijith"
}
}
}
}
}

And recieved

{
took: 1
timed_out: false
_shards: {
total: 2
successful: 2
failed: 0

}
hits: {
total: 1
max_score: 1
hits: [
{
_index: algotree
_type: parent
_id: aa8GhCZyRr6FjRigMF4GAQ
_score: 1
_source: {
names: algotree

}

}

]

}

}

Here the result is fine , but i was expecting the child result to be combined with the parent.
Or at-least it will help if i get child docID.
How can i do it ?

Thanks
Vineeth


(system) #3