Hey all, a while back I posted this question about Parent/Child use case:
http://elasticsearch-users.115913.n3.nabble.com/Parent-Child-use-case-td3347346.html
I've created a gist curl example to walk anyone through the thing I'm trying
to do:
In essense, I have 2 types, a 'doc' (parent) and a 'filecontent' (child)
within the same index. I'd like to be able to search both types in 1 query,
but if a match is found on the child, the results come back with the parent
record only, with all results sorted by fields in the parent.
I've got multiple issues here:
a) the final search query doesn't work, so clearly I have no idea what I'm
doing with respect to this top_children query
b) i'm not sure if I'm misinterpretting the way the parent/child is supposed
to work
I've set the child mapping to point to the parent type as indicated in the
docs for the _parent type. I'm presuming the routing is then taken care of
so the indexing of the child filecontent record can be routed to the same
shard as the parent (doc) record for searching later on.
I've tried hard to read the docs in elasticsearch on the parent/child
mapping, and I maybe just a bonehead here. This is a fairly critical use
case for us in the future, we don't index the file content at the moment
because it's hundreds of millions of records and an awful lot of content, so
do not want continuous meta-data record changes being indexed to require
retrieving and indexing file content over and over and over again.
Many thanks to anyone that can help here.
cheers,
Paul Smith