# Solved: fragCharSize(0) is too small. It must be 18 or higher

**URL:** https://discuss.elastic.co/t/solved-fragcharsize-0-is-too-small-it-must-be-18-or-higher/131891
**Category:** Elasticsearch
**Created:** [May 15, 2018, 9:03am UTC](https://discuss.elastic.co/t/solved-fragcharsize-0-is-too-small-it-must-be-18-or-higher/131891 "2018-05-15T09:03:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![astrodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/astrodi/32/117732_2.png) [@astrodi](https://discuss.elastic.co/u/astrodi)
#### Post date: [May 15, 2018, 9:03am UTC](https://discuss.elastic.co/t/solved-fragcharsize-0-is-too-small-it-must-be-18-or-higher/131891/1 "2018-05-15T09:03:51Z")

</div>

Hi there,

I needed to resolve a bug with "plain" highlighter (very same like here: [Highlighter trim a field, why?](https://discuss.elastic.co/t/highlighter-trim-a-field-why/36779))  
My use case:  
"plain" highlighter returned "United States (USA" instead of "United States (USA)", no\_match\_size is 1000.  
"plain" highlighter was also not able to highlight exact match (in one \<em\> tag).

So, I realized to use "fvh" highlighter. It worked well with normal query  
Mapping:  
...  
"LOSS\_LOCATION":{  
"type":"text",  
"term\_vector":"with\_positions\_offsets"  
}  
...

Highlighting:  
"query": {  
"query\_string": {  
"default\_field": "content.LOSS\_LOCATION",  
"query": ""United States""  
}  
},  
"highlight": {  
"fields": {  
"content.LOSS\_LOCATION": {  
"fragment\_size": 0,  
"number\_of\_fragments": 0,  
"no\_match\_size":1000,  
"type":"fvh"  
}  
}  
}

Response:  
....  
"highlight": {  
"content.LOSS\_LOCATION": [  
"\<em\>United States\</em\> (USA)"  
]  
}

But, once I used Query template, I obtained follwing error:

> fragCharSize(0) is too small. It must be 18 or higher.

Do anyone knows, what could be the rootcause? How to handle this?

Thanks in advance

---

<div class="post-metadata">

### Author: ![astrodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/astrodi/32/117732_2.png) [@astrodi](https://discuss.elastic.co/u/astrodi)
#### Post date: [May 15, 2018, 1:53pm UTC](https://discuss.elastic.co/t/solved-fragcharsize-0-is-too-small-it-must-be-18-or-higher/131891/2 "2018-05-15T13:53:20Z")

</div>

Ok, I found the problem by myself.  
One of attribute in highlighting had:

> "fragment\_size": 0

I changed this to higher value and it works well

---

<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: [June 12, 2018, 1:53pm UTC](https://discuss.elastic.co/t/solved-fragcharsize-0-is-too-small-it-must-be-18-or-higher/131891/3 "2018-06-12T13:53:26Z")

</div>

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