# Problem with highlighting using QueryStringQueryBuilder

**URL:** https://discuss.elastic.co/t/problem-with-highlighting-using-querystringquerybuilder/4540
**Category:** Elasticsearch
**Created:** [June 3, 2011, 3:41am UTC](https://discuss.elastic.co/t/problem-with-highlighting-using-querystringquerybuilder/4540 "2011-06-03T03:41:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Weiwei\_Wang](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@Weiwei\_Wang](https://discuss.elastic.co/u/Weiwei_Wang)
#### Post date: [June 3, 2011, 3:41am UTC](https://discuss.elastic.co/t/problem-with-highlighting-using-querystringquerybuilder/4540/1 "2011-06-03T03:41:17Z")

</div>

e.g.  
Documents with two fields: prefix and name

1. name is analyzed using whitespace tokenizer and n-gram  
filter(min=1,max=20)
2. I also extract the first character from name and indexed it without  
analyzer

After setting up the index, i use TransportClient to do the search  
request on useing QueryStringQueryBuilder on fields: name(no prefix)

and highlight fields are only: name

suppose i have a document:{"name":"null", "prefix":"n"}

when i search with: n, the result is ok and aslo correctly highlighted  
however when I search with: prefix:n, it still highlight "n" which is  
not what i want.

Does anyone here know why and how to fix it?

---

<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:04am UTC](https://discuss.elastic.co/t/problem-with-highlighting-using-querystringquerybuilder/4540/2 "2017-07-06T04:04:45Z")

</div>


