getting parent id in parent-child mapping

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

getting parent id in parent-child mapping

Chetana
I am using parent-child and the mapping is having the field _parent and I set parent to actual parent id during indexing.
But the search result returns all the fields except the parent and I also could not figure out any method to get the parent id.
How should I get a parent id of the child document ?
 
Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: getting parent id in parent-child mapping

q42jaap
Hi Chetana,

You can specify the _parent and _source in the fields. It will list the _parent in the "fields" array in the hit, but the _source will be at it's normal place in the hit.

curl 'localhost:9200/indexname/childname/_search' -d '{
  fields:["_parent", "_source"]
}'

See also:

Jaap

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.