# Highlight encoder

**URL:** https://discuss.elastic.co/t/highlight-encoder/15069
**Category:** Elasticsearch
**Created:** [January 1, 2014, 1:37pm UTC](https://discuss.elastic.co/t/highlight-encoder/15069 "2014-01-01T13:37:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Guozhu\_Wei](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@Guozhu\_Wei](https://discuss.elastic.co/u/Guozhu_Wei)
#### Post date: [January 1, 2014, 1:37pm UTC](https://discuss.elastic.co/t/highlight-encoder/15069/1 "2014-01-01T13:37:34Z")

</div>

Dear all

Happy new year!

I have a problem when I use the highlight, I want to highlight a field  
'abs' while it contains html, like:

the content of field 'abs':  
... The molecule:(L2L3M)n ...

I want to escape the html when highlight and found that the "encoder" option.

I use this option:

```
"highlight": {
    "escape_html": "html",
    "pre_tags": ["<strong><span class=\"text-danger\">"],
    "post_tags": ["</span></strong>"],
    "fields": {
        "abs": {
            "fragment_size": 150,
            "number_of_fragments": 1,
            "no_match_size": 150
        }
    }
},

```

but nothing changed, the html tags like '' still returned untouched.

Any hints of what could be wrong?

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CANnJ\_2ObfTrUa9fvb2hkB0wNhSaPw5u9fSc\_h\_RM%2B56irmCMzg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CANnJ_2ObfTrUa9fvb2hkB0wNhSaPw5u9fSc_h_RM%2B56irmCMzg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)
#### Post date: [January 1, 2014, 3:14pm UTC](https://discuss.elastic.co/t/highlight-encoder/15069/2 "2014-01-01T15:14:27Z")

</div>

Hi,

You try to use parameter "encoder" instead of "escape\_html".

See:

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

Regards,

2014/1/1 Guozhu Wei [weiguozhu@gmail.com](mailto:weiguozhu@gmail.com)

> Dear all
> 
> Happy new year!
> 
> I have a problem when I use the highlight, I want to highlight a field  
> 'abs' while it contains html, like:
> 
> the content of field 'abs':  
> ... The molecule:(L2L3M)n ...
> 
> I want to escape the html when highlight and found that the "encoder"  
> option.
> 
> I use this option:
> 
> ```
> "highlight": {
> "escape_html": "html",
> "pre_tags": ["<strong><span class=\"text-danger\">"],
> "post_tags": ["</span></strong>"],
> "fields": {
> "abs": {
> "fragment_size": 150,
> "number_of_fragments": 1,
> "no_match_size": 150
> }
> }
> },
> 
> ```
> 
> but nothing changed, the html tags like '' still returned untouched.
> 
> Any hints of what could be wrong?
> 
> Thanks!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CANnJ\_2ObfTrUa9fvb2hkB0wNhSaPw5u9fSc\_h\_RM%2B56irmCMzg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CANnJ_2ObfTrUa9fvb2hkB0wNhSaPw5u9fSc_h_RM%2B56irmCMzg%40mail.gmail.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

## --

Jun Ohtani  
blog : [http://blog.johtani.info](http://blog.johtani.info)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPW8A5yoqwNRRuAxBOzH\_DpFXzSYzA%2Bp3F4HGM%3D4aSWvVA8tZQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPW8A5yoqwNRRuAxBOzH_DpFXzSYzA%2Bp3F4HGM%3D4aSWvVA8tZQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:58am UTC](https://discuss.elastic.co/t/highlight-encoder/15069/3 "2017-07-06T01:58:49Z")

</div>


