# Highlight parameter 'boundary\_chars' does not work as expected

**URL:** <https://discuss.elastic.co/t/highlight-parameter-boundary-chars-does-not-work-as-expected/57809>\
**Category:** Elasticsearch\
**Created:** [August 11, 2016, 12:20pm UTC](https://discuss.elastic.co/t/highlight-parameter-boundary-chars-does-not-work-as-expected/57809 "2016-08-11T12:20:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpzdm](https://avatars.discourse-cdn.com/v4/letter/w/8797f3/32.png) [@wpzdm](https://discuss.elastic.co/u/wpzdm)\
**Post date:** [August 11, 2016, 12:20pm UTC](https://discuss.elastic.co/t/highlight-parameter-boundary-chars-does-not-work-as-expected/57809/1 "2016-08-11T12:20:59Z")

</div>

I used hightlight with parameter 'boundary\_chars', but not always get fragment truncated at boundary characters.

Example:

```
PUT wpz_2

PUT wpz_2/_mapping/test
{
  "properties": {
    "test": {
      "analyzer": "index_ansj", 
      "type": "string", 
      "term_vector": "with_positions_offsets"
    }
  }
}

PUT wpz_2/test/3
{
  "test": "，全市工业80%以上的大型装备实现了信息化集成。投资2000万元启动“智慧企业”专项行动，重点支持工业企业无线、物联技术应用。"
}
GET wpz_2/test/_search
{
  "query": {
    "match": {
      "test": "智慧"
    }
  }
  , "highlight": {
    "boundary_chars": ".,!?；，。？！",
    "fragment_size": 30,
    "fields": {
      "test": {}
    }
  }
}

```

Output:

```
{
  "took": 4,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.057534903,
    "hits": [
      {
        "_index": "wpz_2",
        "_type": "test",
        "_id": "3",
        "_score": 0.057534903,
        "_source": {
          "test": "，全市工业80%以上的大型装备实现了信息化集成。投资2000万元启动“智慧企业”专项行动，重点支持工业企业无线、物联技术应用。"
        },
        "highlight": {
          "test": [
            "集成。投资2000万元启动“<em>智慧</em>企业”专项行动，重点支持工业企业无线、物联技术应用"
          ]
        }
      }
    ]
  }
}

```

The highlight fragment is not truncated at '。' (third character)  
I also tried standard analyzer, result is the same. Can I always get fragment truncated at boundary characters? Here, what I expect is:  
`"投资2000万元启动“<em>智慧</em>企业”专项行动，重点支持工业企业无线、物联技术应用"`

I'm using ES 2.3.3

Best regards,  
Abel

---

<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 5, 2017, 10:28pm UTC](https://discuss.elastic.co/t/highlight-parameter-boundary-chars-does-not-work-as-expected/57809/2 "2017-07-05T22:28:25Z")

</div>


