Returning context from other fields in the highlighter

(Ragnar Rova) #1

When using the highlighter with match queries, how can I get context from another field on the same nesting level?

Lets say I have a document like

texts: [ { text: "quick brown fox", time: 17 }, ..., { text: "many cunning foxes", time: 213 } ]

If I search using match_phrase and match queries in texts.text and instruct the highlighter to return back texts.text, I only get highlights around the words in texts.texts. How do I access the corresponding time field for each highlight? Currently I try to search in the raw source on the client, but this is error-prone. Is there a better way?

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.