# Trim the Content after applying highlight funciton

**URL:** https://discuss.elastic.co/t/trim-the-content-after-applying-highlight-funciton/163578
**Category:** Elasticsearch
**Created:** [January 9, 2019, 4:22pm UTC](https://discuss.elastic.co/t/trim-the-content-after-applying-highlight-funciton/163578 "2019-01-09T16:22:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anveshdd](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@anveshdd](https://discuss.elastic.co/u/anveshdd)
#### Post date: [January 9, 2019, 4:22pm UTC](https://discuss.elastic.co/t/trim-the-content-after-applying-highlight-funciton/163578/1 "2019-01-09T16:22:39Z")

</div>

Working on Elastic Search 6.5.2. Need to trim the content field to 300 characters after applying highlighting. I don't want to increase the number of fragments. Any suggestions.

````auto
{
    "query":{
      "multi_match" : {
      "query": "test", 
      "fields": ["title", "content"] 
   } 
   },
   "highlight":{
      "fields":{
         "title":{
            "pre_tags":[
               "<strong>"
            ],
            "post_tags":[
               "</strong>"
            ],
            "number_of_fragments":0            
         },
         "content":{
            "pre_tags":[
               "<strong>"
            ],
            "post_tags":[
               "</strong>"
            ],
           "number_of_fragments":0           
         }
      }
   }
}```
````

---

<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: [February 6, 2019, 4:22pm UTC](https://discuss.elastic.co/t/trim-the-content-after-applying-highlight-funciton/163578/2 "2019-02-06T16:22:40Z")

</div>

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