Highlight in the field response

Good morning,

I have an application that read the results from my query in elasticsearch and I take all the fields of the response and after it, I put it in a windows form for the user.

Now I would like remark the part when I have a result in Highlight, but my question is, is it possible that the remarks (< em >) appears in the field response?

In negative case..I'm doing a loop in Highlight searching if exists in the document to replace it but is inefficient :frowning:

Thanks for the help!!

Hi @Kirtash,

Are you making use of the Highlighting capability of Elasticsearch? It should return the <em> fields in the right place for you.

Hi @carly.richmond,

Yes, but It returns these results outside of the source. For example, If I make a query to highlighting the word "ande" in a index that I have the name "Alexander", I will receive the next:

"_source": {
          "info": {
            "name": "ALEXANDER",
},
"highlight": {
          "info.name": [
            "ALEX<em>ANDER</em>"
          ]
 }

I would like that this structure with the tag coud be in the source field

Thanks and sorry for my bad explanation.

I don't believe you can include it in the source field. Can you give an example of what you mean by the negative case that you need to loop for?

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