# Optimize elasticsearch query using highlighting

**URL:** <https://discuss.elastic.co/t/optimize-elasticsearch-query-using-highlighting/148562>\
**Category:** Elasticsearch\
**Created:** [September 14, 2018, 6:55am UTC](https://discuss.elastic.co/t/optimize-elasticsearch-query-using-highlighting/148562 "2018-09-14T06:55:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikesh/32/86579_2.png) [@Nikesh](https://discuss.elastic.co/u/Nikesh)\
**Post date:** [September 14, 2018, 6:55am UTC](https://discuss.elastic.co/t/optimize-elasticsearch-query-using-highlighting/148562/1 "2018-09-14T06:55:00Z")

</div>

I used the highlight feature of elasticsearch and found the time taken for search has increased dramatically. To give you an example on a 50,000 record set, when searching without highlight, the query took 194ms and while using highlight 2991ms. Can you please let me know why when using highlight is used, processing time is high?  
An example query is mentioned below:

{  
"from": 30,  
"size": 60,  
"query": {  
"bool": {  
"must": {  
"multi\_match": {  
"query": "shall have the right",  
"fields": [  
"subType",  
"title",  
"type",  
"content"  
],  
"fuzziness": 1

}  
}  
}  
},  
"highlight": {  
"type": "unified",  
"fields": {  
"\*": {}  
}  
}  
}

---

<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:** [October 12, 2018, 6:55am UTC](https://discuss.elastic.co/t/optimize-elasticsearch-query-using-highlighting/148562/2 "2018-10-12T06:55:07Z")

</div>

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