# Highlight not always shown

**URL:** <https://discuss.elastic.co/t/highlight-not-always-shown/3802>\
**Category:** Elasticsearch\
**Created:** [January 18, 2011, 12:48pm UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802 "2011-01-18T12:48:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max/32/2236_2.png) [@max](https://discuss.elastic.co/u/max)\
**Post date:** [January 18, 2011, 12:48pm UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802/1 "2011-01-18T12:48:41Z")

</div>

Hi,

we are using elasticsearch for indexing a lot of html-documents (right  
now around 90k, indexsize is around 2GB). everything is great, we love  
elasticsearch!

but we noticed one thing we cannot understand. we use the following  
search:  
{  
"from" : 0, "size" : 10,  
"sort" : [  
{"time" : "desc"}  
],

```
    "query" : {
                      "filtered" : {
                           "query" : {
                                    "query_string" : {
                                            "fields" :

```

["title","text"],  
"query" :  
"",  
"default\_operator" :  
"AND"  
}  
},  
"filter" : {  
"and" : [  
{  
"term" :  
{"user" : ""}  
}  
]  
}  
}  
},  
"highlight" : {  
"pre\_tags" : ["**"],  
"post\_tags" : ["**"],  
"fields" : {  
"text" : {"fragment\_size" : 100,  
"number\_of\_fragments" : 1}  
}  
}  
}

the search finds the right documents, but the highlight-field is  
sometimes filled, sometimes empty (the text-field ist stored as a  
field too, as we had to do it before 0.14.0). if i search for  
different words and find the same documents for some words the  
highlight is there, for some words not (in the same document we find).

any ideas why?

Thanks a lot audn keep up with the great work!  
MAX

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 18, 2011, 6:26pm UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802/2 "2011-01-18T18:26:35Z")

</div>

Heya,

Its a bug fixed in master / 0.14 branch.

-shay.banon  
On Tuesday, January 18, 2011 at 2:48 PM, max wrote:

> Hi,
> 
> we are using elasticsearch for indexing a lot of html-documents (right  
> now around 90k, indexsize is around 2GB). everything is great, we love  
> elasticsearch!
> 
> but we noticed one thing we cannot understand. we use the following  
> search:  
> {  
> "from" : 0, "size" : 10,  
> "sort" : [  
> {"time" : "desc"}  
> ],
> 
> "query" : {  
> "filtered" : {  
> "query" : {  
> "query\_string" : {  
> "fields" :  
> ["title","text"],  
> "query" :  
> "",  
> "default\_operator" :  
> "AND"  
> }  
> },  
> "filter" : {  
> "and" : [  
> {  
> "term" :  
> {"user" : ""}  
> }  
> ]  
> }  
> }  
> },  
> "highlight" : {  
> "pre\_tags" : ["**"],  
> "post\_tags" : ["**"],  
> "fields" : {  
> "text" : {"fragment\_size" : 100,  
> "number\_of\_fragments" : 1}  
> }  
> }  
> }
> 
> the search finds the right documents, but the highlight-field is  
> sometimes filled, sometimes empty (the text-field ist stored as a  
> field too, as we had to do it before 0.14.0). if i search for  
> different words and find the same documents for some words the  
> highlight is there, for some words not (in the same document we find).
> 
> any ideas why?
> 
> Thanks a lot audn keep up with the great work!  
> MAX

---

<div class="post-metadata">

**Author:** ![max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max/32/2236_2.png) [@max](https://discuss.elastic.co/u/max)\
**Post date:** [January 21, 2011, 10:06am UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802/3 "2011-01-21T10:06:53Z")

</div>

hi,

thank you for the fast response!

we did a "./gradlew clean release" and installed this 0.15.0-SNAPSHOT  
and still have the same problem. sometimes the highlight is there,  
sometimes not, any ideas why?

thank you very much,  
MAX

On Jan 18, 7:26 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Heya,
> 
> Its a bug fixed in master / 0.14 branch.
> 
> -shay.banon
> 
> On Tuesday, January 18, 2011 at 2:48 PM, max wrote:
> 
> > Hi,
> 
> > we are using elasticsearch for indexing a lot of html-documents (right  
> > now around 90k, indexsize is around 2GB). everything is great, we love  
> > elasticsearch!
> 
> > but we noticed one thing we cannot understand. we use the following  
> > search:  
> > {  
> > "from" : 0, "size" : 10,  
> > "sort" : [  
> > {"time" : "desc"}  
> > ],
> 
> > "query" : {  
> > "filtered" : {  
> > "query" : {  
> > "query\_string" : {  
> > "fields" :  
> > ["title","text"],  
> > "query" :  
> > "",  
> > "default\_operator" :  
> > "AND"  
> > }  
> > },  
> > "filter" : {  
> > "and" : [  
> > {  
> > "term" :  
> > {"user" : ""}  
> > }  
> > ]  
> > }  
> > }  
> > },  
> > "highlight" : {  
> > "pre\_tags" : ["**"],  
> > "post\_tags" : ["**"],  
> > "fields" : {  
> > "text" : {"fragment\_size" : 100,  
> > "number\_of\_fragments" : 1}  
> > }  
> > }  
> > }
> 
> > the search finds the right documents, but the highlight-field is  
> > sometimes filled, sometimes empty (the text-field ist stored as a  
> > field too, as we had to do it before 0.14.0). if i search for  
> > different words and find the same documents for some words the  
> > highlight is there, for some words not (in the same document we find).
> 
> > any ideas why?
> 
> > Thanks a lot audn keep up with the great work!  
> > MAX

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [January 21, 2011, 10:10am UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802/4 "2011-01-21T10:10:34Z")

</div>

Max,

how do you analyze the HTML source text and how do you store it in ES? Are  
you sure you removed all html tags before highlighting takes action?

Regards,  
Lukas

On Fri, Jan 21, 2011 at 11:06 AM, max [max@kossatz.com](mailto:max@kossatz.com) wrote:

> hi,
> 
> thank you for the fast response!
> 
> we did a "./gradlew clean release" and installed this 0.15.0-SNAPSHOT  
> and still have the same problem. sometimes the highlight is there,  
> sometimes not, any ideas why?
> 
> thank you very much,  
> MAX
> 
> On Jan 18, 7:26 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Heya,
> > 
> > Its a bug fixed in master / 0.14 branch.
> > 
> > -shay.banon
> > 
> > On Tuesday, January 18, 2011 at 2:48 PM, max wrote:
> > 
> > > Hi,
> > 
> > > we are using elasticsearch for indexing a lot of html-documents (right  
> > > now around 90k, indexsize is around 2GB). everything is great, we love  
> > > elasticsearch!
> > 
> > > but we noticed one thing we cannot understand. we use the following  
> > > search:  
> > > {  
> > > "from" : 0, "size" : 10,  
> > > "sort" : [  
> > > {"time" : "desc"}  
> > > ],
> > 
> > > "query" : {  
> > > "filtered" : {  
> > > "query" : {  
> > > "query\_string" : {  
> > > "fields" :  
> > > ["title","text"],  
> > > "query" :  
> > > "",  
> > > "default\_operator" :  
> > > "AND"  
> > > }  
> > > },  
> > > "filter" : {  
> > > "and" : [  
> > > {  
> > > "term" :  
> > > {"user" : ""}  
> > > }  
> > > ]  
> > > }  
> > > }  
> > > },  
> > > "highlight" : {  
> > > "pre\_tags" : ["**"],  
> > > "post\_tags" : ["**"],  
> > > "fields" : {  
> > > "text" : {"fragment\_size" : 100,  
> > > "number\_of\_fragments" : 1}  
> > > }  
> > > }  
> > > }
> > 
> > > the search finds the right documents, but the highlight-field is  
> > > sometimes filled, sometimes empty (the text-field ist stored as a  
> > > field too, as we had to do it before 0.14.0). if i search for  
> > > different words and find the same documents for some words the  
> > > highlight is there, for some words not (in the same document we find).
> > 
> > > any ideas why?
> > 
> > > Thanks a lot audn keep up with the great work!  
> > > MAX

---

<div class="post-metadata">

**Author:** ![max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max/32/2236_2.png) [@max](https://discuss.elastic.co/u/max)\
**Post date:** [January 21, 2011, 10:21am UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802/5 "2011-01-21T10:21:05Z")

</div>

yes, all html-tags removed.  
the "funny" thing is: for the same document depending on the  
searchterm the highlight is or is not in the search-result. the  
document itself is always found.

MAX

On Jan 21, 11:10 am, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:

> Max,
> 
> how do you analyze the HTML source text and how do you store it in ES? Are  
> you sure you removed all html tags before highlighting takes action?
> 
> Regards,  
> Lukas
> 
> On Fri, Jan 21, 2011 at 11:06 AM, max [m...@kossatz.com](mailto:m...@kossatz.com) wrote:
> 
> > hi,
> 
> > thank you for the fast response!
> 
> > we did a "./gradlew clean release" and installed this 0.15.0-SNAPSHOT  
> > and still have the same problem. sometimes the highlight is there,  
> > sometimes not, any ideas why?
> 
> > thank you very much,  
> > MAX
> 
> > On Jan 18, 7:26 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Heya,
> 
> > > Its a bug fixed in master / 0.14 branch.
> 
> > > -shay.banon
> 
> > > On Tuesday, January 18, 2011 at 2:48 PM, max wrote:
> > > 
> > > > Hi,
> 
> > > > we are using elasticsearch for indexing a lot of html-documents (right  
> > > > now around 90k, indexsize is around 2GB). everything is great, we love  
> > > > elasticsearch!
> 
> > > > but we noticed one thing we cannot understand. we use the following  
> > > > search:  
> > > > {  
> > > > "from" : 0, "size" : 10,  
> > > > "sort" : [  
> > > > {"time" : "desc"}  
> > > > ],
> 
> > > > "query" : {  
> > > > "filtered" : {  
> > > > "query" : {  
> > > > "query\_string" : {  
> > > > "fields" :  
> > > > ["title","text"],  
> > > > "query" :  
> > > > "",  
> > > > "default\_operator" :  
> > > > "AND"  
> > > > }  
> > > > },  
> > > > "filter" : {  
> > > > "and" : [  
> > > > {  
> > > > "term" :  
> > > > {"user" : ""}  
> > > > }  
> > > > ]  
> > > > }  
> > > > }  
> > > > },  
> > > > "highlight" : {  
> > > > "pre\_tags" : ["**"],  
> > > > "post\_tags" : ["**"],  
> > > > "fields" : {  
> > > > "text" : {"fragment\_size" : 100,  
> > > > "number\_of\_fragments" : 1}  
> > > > }  
> > > > }  
> > > > }
> 
> > > > the search finds the right documents, but the highlight-field is  
> > > > sometimes filled, sometimes empty (the text-field ist stored as a  
> > > > field too, as we had to do it before 0.14.0). if i search for  
> > > > different words and find the same documents for some words the  
> > > > highlight is there, for some words not (in the same document we find).
> 
> > > > any ideas why?
> 
> > > > Thanks a lot audn keep up with the great work!  
> > > > MAX

---

<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, 4:13am UTC](https://discuss.elastic.co/t/highlight-not-always-shown/3802/6 "2017-07-06T04:13:23Z")

</div>


