Assume that I have a document like below
{
"_index": "sample",
"_type": "doc",
"_id": "student_id_1",
"_version":2,
"_score":1,
"_source":
{
"title": "Higher secondary",
"DOJ":2020-06-23,
"S_id":"SH123",
"first_name":"Gopiraj",
"last_name":"Muthusamy"
"subjects":[
{
"name":"english"
"type":"communication"
"sub_id":1
},{
"name":"Maths"
"type":"learning"
"sub_id":2
},{
"name":"science"
"type":"learning"
"sub_id":3
}]
}
}
from the above document i using highlight method to display the macthed field and its value but its not returning other fields inside the hash, for example the word that i need to search for is "learning", I'm expecting ES should return like below in highlight or in any other form
[
{
"sub_id":2,
"type":"learning"
},{
"sub_id":3,
"type":"learning"
}
]
Please guide