I'm struggling a bit to write a query that would query fields on a parent
document and the fields on a child document.
first thought, my mapping:
I have documents of type 'resource' (these are the parent docs)
which have a couple of fields, the ones I'll be querying are called
'q_high' and 'q_low'.
I also have documents of type 'message' (the child documents) which have
the same q_high and q_low fields
We've modelled it this way as all top level resources can have messages
associated with them.
When we search for resources, we'd also like to search trough all the
messages that are associated with a resource.
Now I want to write a query where:
- the q_high or q_low field match a string (chicken in the example below)
- OR the q_high/q_low field match the same string.
When a child document matches, I only need the parent document.
So far, I have the following Bool query:
This works, but the more content I put into the system the lower the score
of child documents get.
When there are only 2 documents in the system (the parent and child) the
child gets a score of about 0.6.
When there are about 660 documents in the system, the score plumets to 0.02
Is there a better way to do queries like this?
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 firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.