# Highlight issue in text search

**URL:** <https://discuss.elastic.co/t/highlight-issue-in-text-search/207290>\
**Category:** Elasticsearch\
**Created:** [November 11, 2019, 7:16am UTC](https://discuss.elastic.co/t/highlight-issue-in-text-search/207290 "2019-11-11T07:16:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harsh\_Sahu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harsh_sahu/32/57450_2.png) [@Harsh\_Sahu](https://discuss.elastic.co/u/Harsh_Sahu)\
**Post date:** [November 11, 2019, 7:16am UTC](https://discuss.elastic.co/t/highlight-issue-in-text-search/207290/1 "2019-11-11T07:16:35Z")

</div>

I have created an index which has transcripts of call data and while searching for keyword highlight is not working properly.  
Elastic-search version: 6.8.1  
{  
"settings": {  
"index": {  
"analysis": {  
"filter": {  
"minimal\_english": {  
"name": "minimal\_english",  
"type": "stemmer"  
}  
},  
"analyzer": {  
"observe\_kws\_analyzer": {  
"filter": [  
"standard",  
"lowercase",  
"minimal\_english",  
"porter\_stem"  
],  
"tokenizer": "standard"  
}  
}  
}  
}  
}  
}

"mapping":{  
"properties":{  
"account\_id":{  
"type":"keyword"  
},  
"duration":{  
"type":"integer"  
},  
"transcript":{  
"type":"nested",  
"properties":{  
"conv\_id":{  
"type":"integer"  
}  
"phrase\_analyzed":{  
"type":"text",  
"analyzer": "observe\_kws\_analyzer"  
}  
}  
}  
}  
}

Sample Document:  
{  
"\_id":"b89494f7-182d-4ba8-a3ac-d9ea0f0f6ff4",  
"account\_id": "5be180eef7c85b00017f9477",  
"duration": 216,  
"transcript": [  
{  
"conv\_id": 26,  
"phrase\_analyzed": "thank you so much sir and before we continue i need to let you know that i'm a debt collector i attempting continue to collect a debt any information obtained due this for that purpose also the entire call is being recorded and may be monitored for quality and training purposes"  
}  
]  
}

Query:  
{  
"query": {  
"bool": {  
"must": [  
{  
"ids": {  
"type": ,  
"values": [  
"b89494f7-182d-4ba8-a3ac-d9ea0f0f6ff4"  
],  
"boost": 1  
}  
},  
{  
"bool": {  
"should": [  
{  
"nested": {  
"query": {  
"bool": {  
"must": [  
{  
"bool": {  
"must": [  
{  
"match\_phrase": {  
"transcript.phrase\_analyzed": {  
"query": "this entire call is being recorded and may be monitored for quality and training purposes",  
"slop": 1,  
"zero\_terms\_query": "NONE",  
"boost": 1  
}  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
},  
"path": "transcript",  
"ignore\_unmapped": false,  
"score\_mode": "none",  
"boost": 1,  
"inner\_hits": {  
"name": "inner\_hits\_5d2451d7b91e8c3d3e3660cd\_10",  
"ignore\_unmapped": false,  
"from": 0,  
"size": 100,  
"version": false,  
"seq\_no\_primary\_term": false,  
"explain": false,  
"track\_scores": false,  
"sort": [  
{  
"transcript.conv\_id": {  
"order": "asc"  
}  
}  
],  
"highlight": {  
"pre\_tags": [  
"\<HIGHLIGHT5d2451d7b91e8c3d3e3660cd\_10\>"  
],  
"post\_tags": [  
"\<HIGHLIGHT5d2451d7b91e8c3d3e3660cd\_10/\>"  
],  
"number\_of\_fragments": 0,  
"fields": {  
"transcript.phrase\_analyzed": {}  
}  
}  
}  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
}  
],  
"adjust\_pure\_negative": true,  
"boost": 1  
}  
},  
"\_source": {  
"includes": [  
"account\_id",  
"duration"  
]  
}  
}

Response:  
{  
"hits": {  
"hits": [  
{  
"\_type": "meetings",  
"\_source": {  
"duration": 216,  
"account\_id": "5be180eef7c85b00017f9477"  
},  
"\_score": 1,  
"inner\_hits": {  
"inner\_hits\_5d2451d7b91e8c3d3e3660cd\_10": {  
"hits": {  
"hits": [  
{  
"sort": [  
26  
],  
"\_type": "meetings",  
"\_source": {  
"conv\_id": 26,  
"phrase\_analyzed": "thank you so much sir and before we continue i need to let you know that i'm a debt collector i attempting continue to collect a debt any information obtained due this for that purpose also the entire call is being recorded and may be monitored for quality and training purposes"  
},  
"\_score": null,  
"\_index": "meetings\_with\_transcript",  
"\_nested": {  
"field": "transcript",  
"offset": 26  
},  
"\_id": "b89494f7-182d-4ba8-a3ac-d9ea0f0f6ff4"  
}  
],  
"total": 1,  
"max\_score": null  
}  
}  
},  
"\_index": "meetings\_with\_transcript",  
"\_id": "b89494f7-182d-4ba8-a3ac-d9ea0f0f6ff4"  
}  
],  
"total": 1,  
"max\_score": 1  
},  
"\_shards": {  
"successful": 10,  
"failed": 0,  
"skipped": 0,  
"total": 10  
},  
"took": 90,  
"timed\_out": false  
}

I am not getting any highlight in this query. Also, if I change the query text to "the entire call is being recorded and may be monitored for quality and training purposes"(This is the case of exact match of keyword), then I get the appropriate highlight.

I think that with the previous query search, highlight should be there. Is this a bug? If not, whats the logic behind this.

---

<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:** [December 9, 2019, 7:16am UTC](https://discuss.elastic.co/t/highlight-issue-in-text-search/207290/2 "2019-12-09T07:16:36Z")

</div>

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