-
Notifications
You must be signed in to change notification settings - Fork 25.2k
In hierarchical documents, under certain scenarios, snippets for descendant documents don't turn up #40572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your query contains two
and the other one with no name:
|
Hello @jimczi, If I remove, empty inner_hits, reply document snippets are not returned. Please try the same at your end once. If my understanding is wrong, could you please share the query that returns both comments and replies without missing any of the matching snippets. That would be immensely helpful -Kowndinya |
I tested the following query in 5.6:
As I said above you need to set an explicit name in your
and the highlights are returned as expected. |
Thanks @jimczi for the query. With this I could get comments and replies as expected but I have few queries. When I first time wrote the query, I did not have empty "inner_hits" fragment. When reply documents were not turning up in highlights section, it was a guess work to add the empty inner_hits as it was not clear from documentation how to resolve this. So, why is it required to add an additional dummy inner_hits for reply documents to turn-up? Also, the clash that you are referring to is between two different "match" sections inside "should". One match is for matching documents for comment fields and the other one is matching reply fields. As an end user of elastic search, my expectation was that it should have worked without the additional inner_hits. Is this some implementation issue that is addressed in 5.1+ releases already? For me the issue with adding a random name for inner_hits is that it breaks certain assumptions that we make while parsing the response. Essentially we go by type name. |
You have two level of parent-child,
These two
This works if you have a single
@kowndinyav if you have any further questions please don't answer in this issue but open a topic in the discuss forum, we reserve github for verified bugs and feature requests. |
Elasticsearch version : AWS Elastic Search Service 5.1
Plugins installed: []
JVM version : Should be what ever JVM bundled with AWS Elastic Search Service
OS version (
uname -a
if on a Unix-like system):Description of the problem including expected versus actual behavior:
We have an application where we store documents in hierarchical manner. At a high level, structure is "board -> post -> comment -> reply".
The requirement is to be able to search given text inside "Post" hierarchy i.e if text matches any of the fields from post, comment and reply documents, return post with matched snippets. One problem that we are observing is, post object is always returned when it matches any of the post, comment and reply fields. But in some cases snippets are not turning up.
For example, in the given scenario from the attachments, when searched for text "document", it fails to produce comment snippet for '202_post' (post it-self is returned).
According to my understanding, given that post object is always returned with matched criteria, there is no issue in matching but there is some issue preparing the response for snippets.
Steps to reproduce
Attachments should help in reproducing the issue
create.txt

query.txt
response.txt
The text was updated successfully, but these errors were encountered: