# No highlighting of exact mach terms in analyzed field

**URL:** <https://discuss.elastic.co/t/no-highlighting-of-exact-mach-terms-in-analyzed-field/14871>\
**Category:** Elasticsearch\
**Created:** [December 15, 2013, 3:26pm UTC](https://discuss.elastic.co/t/no-highlighting-of-exact-mach-terms-in-analyzed-field/14871 "2013-12-15T15:26:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maya](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Maya](https://discuss.elastic.co/u/Maya)\
**Post date:** [December 15, 2013, 3:26pm UTC](https://discuss.elastic.co/t/no-highlighting-of-exact-mach-terms-in-analyzed-field/14871/1 "2013-12-15T15:26:09Z")

</div>

Hello All,

We perform exact match query on \_all field and highlight an _analyzed field  
(text.), which contains the text:  
{  
"query" : {  
"bool" : {  
"must" : [ {  
"bool" : {  
"must" : [ {  
"query\_string" : {  
"query" : ""published in 1937"",  
"fields" : ["\_all"],  
"default\_operator" : "and",  
"boost" : 10.0  
}  
} ]  
}  
} ]  
}  
},  
"filter" : {  
"and" : {  
"filters" : [ {  
"and" : {  
"filters" : [ {  
"fquery" : {  
"query" : {  
"query\_string" : {  
"query" : ""58468762-fddc-44ea-af4a-270d00000080"",  
"fields" : ["\_id"]  
}  
},  
"\_cache" : true  
}  
} ]  
}  
} ]  
}  
},  
"fields" : ["\_source", "\_score"],  
"track\_scores" : true,  
"highlight" : {  
"fields" : {  
"text._" : {  
"fragment\_size" : 50000,  
"number\_of\_fragments" : 1000  
}  
}  
}  
}

We receive a document for result, but it has no highlighting. Sometimes  
there is partial highlighting: for example if we search for "we live in NY"  
the highlight is: _live_ in _NY\</em and not the full match._

 

_Can you please explain what do we do wrong?_

 

_Many Thanks._

 

_Maya_

 

_>_ 

 

_--  
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/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)._

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [December 16, 2013, 10:25am UTC](https://discuss.elastic.co/t/no-highlighting-of-exact-mach-terms-in-analyzed-field/14871/2 "2013-12-16T10:25:16Z")

</div>

Hi,

I'm not sure why you don't get highlights for this particular query, but  
regarding the "we live in NY" example, I would guess that you are either  
using the default analyzer or an analyzer that has stop words configured,  
and this causes very common words such as "we" or "in" to be ignored when  
highlighting. Here is an example that would highlight "we" and "in":

> <https://gist.github.com/jpountz/7984942>

On Sun, Dec 15, 2013 at 4:26 PM, mayap [maya.pollack@gmail.com](mailto:maya.pollack@gmail.com) wrote:

> Hello All,
> 
> We perform exact match query on \_all field and highlight an _analyzed field  
> (text.), which contains the text:  
> {  
> "query" : {  
> "bool" : {  
> "must" : [ {  
> "bool" : {  
> "must" : [ {  
> "query\_string" : {  
> "query" : ""published in 1937"",  
> "fields" : ["\_all"],  
> "default\_operator" : "and",  
> "boost" : 10.0  
> }  
> } ]  
> }  
> } ]  
> }  
> },  
> "filter" : {  
> "and" : {  
> "filters" : [ {  
> "and" : {  
> "filters" : [ {  
> "fquery" : {  
> "query" : {  
> "query\_string" : {  
> "query" : ""58468762-fddc-44ea-af4a-270d00000080"",  
> "fields" : ["\_id"]  
> }  
> },  
> "\_cache" : true  
> }  
> } ]  
> }  
> } ]  
> }  
> },  
> "fields" : ["\_source", "\_score"],  
> "track\_scores" : true,  
> "highlight" : {  
> "fields" : {  
> "text._" : {  
> "fragment\_size" : 50000,  
> "number\_of\_fragments" : 1000  
> }  
> }  
> }  
> }
> 
> We receive a document for result, but it has no highlighting. Sometimes  
> there is partial highlighting: for example if we search for "we live in NY"  
> the highlight is: _live_ in _NY\</em and not the full match._
> 
>  
> 
> _Can you please explain what do we do wrong?_
> 
>  
> 
> _Many Thanks._
> 
>  
> 
> _Maya_
> 
>  
> 
> _>_ 
> 
>  
> 
> _--  
> 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/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)._

 

_--  
Adrien Grand_

 

_--  
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/CAL6Z4j4QPOyDty3fa%3Dh-jHXNv%3Dxezr\_HquJywWc5Sb-%2BszD3uw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4QPOyDty3fa%3Dh-jHXNv%3Dxezr_HquJywWc5Sb-%2BszD3uw%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:** ![Maya](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Maya](https://discuss.elastic.co/u/Maya)\
**Post date:** [December 16, 2013, 11:53am UTC](https://discuss.elastic.co/t/no-highlighting-of-exact-mach-terms-in-analyzed-field/14871/3 "2013-12-16T11:53:11Z")

</div>

Thanks!

On Monday, December 16, 2013 12:25:16 PM UTC+2, Adrien Grand wrote:

> Hi,
> 
> I'm not sure why you don't get highlights for this particular query, but  
> regarding the "we live in NY" example, I would guess that you are either  
> using the default analyzer or an analyzer that has stop words configured,  
> and this causes very common words such as "we" or "in" to be ignored when  
> highlighting. Here is an example that would highlight "we" and "in":  
> [Highlighting of stop words · GitHub](https://gist.github.com/jpountz/7984942)
> 
> On Sun, Dec 15, 2013 at 4:26 PM, mayap \<[maya.p...@gmail.com](mailto:maya.p...@gmail.com) \<javascript:\>\>wrote:
> 
> > Hello All,
> > 
> > We perform exact match query on \_all field and highlight an _analyzed field  
> > (text.), which contains the text:  
> > {  
> > "query" : {  
> > "bool" : {  
> > "must" : [ {  
> > "bool" : {  
> > "must" : [ {  
> > "query\_string" : {  
> > "query" : ""published in 1937"",  
> > "fields" : ["\_all"],  
> > "default\_operator" : "and",  
> > "boost" : 10.0  
> > }  
> > } ]  
> > }  
> > } ]  
> > }  
> > },  
> > "filter" : {  
> > "and" : {  
> > "filters" : [ {  
> > "and" : {  
> > "filters" : [ {  
> > "fquery" : {  
> > "query" : {  
> > "query\_string" : {  
> > "query" : ""58468762-fddc-44ea-af4a-270d00000080"",  
> > "fields" : ["\_id"]  
> > }  
> > },  
> > "\_cache" : true  
> > }  
> > } ]  
> > }  
> > } ]  
> > }  
> > },  
> > "fields" : ["\_source", "\_score"],  
> > "track\_scores" : true,  
> > "highlight" : {  
> > "fields" : {  
> > "text._" : {  
> > "fragment\_size" : 50000,  
> > "number\_of\_fragments" : 1000  
> > }  
> > }  
> > }  
> > }
> > 
> > We receive a document for result, but it has no highlighting. Sometimes  
> > there is partial highlighting: for example if we search for "we live in NY"  
> > the highlight is: _live_ in _NY\</em and not the full match._
> > 
> >  
> > 
> > _Can you please explain what do we do wrong?_
> > 
> >  
> > 
> > _Many Thanks._
> > 
> >  
> > 
> > _Maya_
> > 
> >  
> > 
> > _>_ 
> > 
> >  
> > 
> > _--  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f3458c8e-7937-460d-a610-59ad8b449a37%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)._
> 
>  
> 
> _--  
> Adrien Grand_

 

_--  
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/6d15eabc-6d90-442e-9111-e9dc4742f00e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6d15eabc-6d90-442e-9111-e9dc4742f00e%40googlegroups.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, 2:01am UTC](https://discuss.elastic.co/t/no-highlighting-of-exact-mach-terms-in-analyzed-field/14871/4 "2017-07-06T02:01:02Z")

</div>


