# Highlighting a script search

**URL:** <https://discuss.elastic.co/t/highlighting-a-script-search/79096>\
**Category:** Elasticsearch\
**Created:** [March 17, 2017, 8:59pm UTC](https://discuss.elastic.co/t/highlighting-a-script-search/79096 "2017-03-17T20:59:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_H1](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@Chris\_H1](https://discuss.elastic.co/u/Chris_H1)\
**Post date:** [March 17, 2017, 8:59pm UTC](https://discuss.elastic.co/t/highlighting-a-script-search/79096/1 "2017-03-17T20:59:31Z")

</div>

We've written a custom search script which finds documents in which both terms occur within the same sentence.  
We also need to get highlighting working on for the hits found by the script.

Is this possible to do?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 18, 2017, 2:59am UTC](https://discuss.elastic.co/t/highlighting-a-script-search/79096/2 "2017-03-18T02:59:16Z")

</div>

I don't believe so. You can highlight the terms by adding a `match` query with the terms either to your query or to `highlight_query`, but there isn't a way for the script to communicate with the highlighter.

---

<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:** [April 15, 2017, 2:59am UTC](https://discuss.elastic.co/t/highlighting-a-script-search/79096/3 "2017-04-15T02:59:35Z")

</div>

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