# App Search Bug with snippet highlighting and closing parenthesis

**URL:** <https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [April 16, 2021, 8:48pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424 "2021-04-16T20:48:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlblake](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@carlblake](https://discuss.elastic.co/u/carlblake)\
**Post date:** [April 16, 2021, 8:48pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424/1 "2021-04-16T20:48:13Z")

</div>

Hello! We are running into a small, but annoying bug with App Search. We have a number of document titles that end with a closing parenthesis. We display the highlighted snippet, but the ending parenthesis is getting cutoff in the snippet, as shown in this example image.

![app_search_parens_bug](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4e37052f81cfe3c9f6dc6497f5ffcc00d4020dad.png)

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [April 19, 2021, 2:26pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424/2 "2021-04-19T14:26:15Z")

</div>

What version of App Search are you using?

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [April 19, 2021, 2:47pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424/3 "2021-04-19T14:47:22Z")

</div>

FWIW, this is a known issue, and it's related to some underlying issues in Elasticsearch's highlighter.

I'm not sure whether or not this was resolved on the latest Elasticsearch, which is why I asked about what version you are using.

For what it is worth, here is a related thread from our search-ui library, where I describe how I've worked around this in the past on some front-end implementations: [Some fields are cut before ")" · Issue #475 · elastic/search-ui · GitHub](https://github.com/elastic/search-ui/issues/475#issuecomment-639010018).

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [April 19, 2021, 2:51pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424/4 "2021-04-19T14:51:13Z")

</div>

Another way you could work around this is to turn snippet "fallback" off for that field. You could then show the "snippet" if it exists, or use the "raw" field if it does not exist. The raw field does not have this problem.

One big word of caution, the "raw" field it NOT escaped, so make sure to handle the raw field as text, not as html, as you would likely do with the snippet field.

---

<div class="post-metadata">

**Author:** ![carlblake](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@carlblake](https://discuss.elastic.co/u/carlblake)\
**Post date:** [April 20, 2021, 1:12pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424/5 "2021-04-20T13:12:35Z")

</div>

Thanks, Jason! We are using the latest version 7.12. We will try using the fallback=false option and raw field.

---

<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:** [May 18, 2021, 1:13pm UTC](https://discuss.elastic.co/t/app-search-bug-with-snippet-highlighting-and-closing-parenthesis/270424/6 "2021-05-18T13:13:03Z")

</div>

Closed on May 18, 2021, 1:13pm UTC

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