Highlight object field, get related field of that object

I'm working with elasticsearch7 and I use highlight in a specific field of an object. My object get 3 attributes :

attribute1
attribute2
attribute3

attribute1 and attribute2 are just number. But I want to search in my attribute3 and other field (witch I did), highlight the field attribute3 if my query match (wich I did) but I also want the attribute1 and attribute2 to be in my highlight. Here is an example

PUT
 { 
   "title": "title",
   "desc": "this is a test",
   "more_info": [{ 
     "rng":     486513,
     "more" : "Lorem ipsum dolor sit amet, consectetur adipiscing elit,"
   },
     {
      "rng": 145142
     "more": "What is my purpose ? To be an example. oh god"
enter code here
   ]
 }

GET
{
     "query": {
            'bool': {
                   'should' : { [
                          'multi_match' : {
                                'query' : 'dolor sit amet'
                                'fields' : [ 'title', 'more_info.more']
                           }
                    ]}
             }
       }
       'highlight' : {
             'fields' : {[
                     'more_info': {
                           "fragment_size" => 0,
                           "number_of_fragments" => 1,
                           "no_match_size" => 250,
                           "boundary_scanner" => "sentence"
                      }
              }]
       }
}

So with that my result is what I want expect in my highlight I got Lorem ipsum dolor sit amet, consectetur adipiscing elit witch is what I want but I also want 486513 somehow somewhere

PS: Keep in mind that I'm working with symfony so I translated from php, it may have some syntax error, but I do have the result that I want, I just don't know how to add the information I want.

You can't highlight a field that didn't match IMO.

Damn, so the best way to do this would be to add my rng inside my field and then work with it once I got the result ?

Probably. I don't see why you would highlight which does not match...

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