You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can highlight things if you use the inner_hits option (0). Just pass inner_hits={"highlight": {"fields": {"nested_path.field": {}}}} to your nested query like so:
s=Search().query('nested', path='comments', query=Q('match', comments__content='python'), inner_hits={"highlight": {"fields": {"comments.content": {}}}})
forhitins:
forcommentinhit.meta.inner_hits.comments.hits:
# not 100% sure about the path, but look into comment.metaforfragmentincomment.meta.highlight['comment.content']:
print(fragment)
First off - awesome library.
Is there a way to highlight hits from nested queries? I don't see anything about it in the docs:
http://elasticsearch-dsl.readthedocs.io/en/latest/api.html#elasticsearch_dsl.Search.highlight
The text was updated successfully, but these errors were encountered: