Adding html_strip filter

Hello all,

I would like to eliminate html tags when I am performing search on certain fields in elastic. Can this be achieved using html_strip filter? If yes, can I have an example on how to add the analyzer and the filter? Thank you


Hi @Srikanth_V .

Maybe this documentation help you.

Hello @RabBit_BR ,

Thanks. This looks fine. My main concern is, I don't want the field to loose the html tags, because I need them for display. I want to strip them when I search on them.


I believe you have the same problem as this post. In this case there are two indexed fields, one with the html text and the other with the text without html.

I would like to have only field. When I create my query on frontend it should be able to find documents that tags as well. For example -

If my text is - Hello 2 (superscript and subscript tags usage)
and in my query if I write Hello 2, I would expect it to find this result

@RabBit_BR : We were able to strip the html while searching, by modifying the mapping -
"analyzer": "custom_my_analyzer",
"search_analyzer": "default" // the default analyzer used,

point to be noted - make sure the custom_my_analyzer inherits the filters from default

Thanks again for your help.

1 Like

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