# Fallback in highlight\_fields not working as documented

**URL:** <https://discuss.elastic.co/t/fallback-in-highlight-fields-not-working-as-documented/218669>\
**Category:** Elastic Search\
**Tags:** elastic-site-search\
**Created:** [February 10, 2020, 9:02pm UTC](https://discuss.elastic.co/t/fallback-in-highlight-fields-not-working-as-documented/218669 "2020-02-10T21:02:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Walding](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_walding/32/1156_2.png) [@Ben\_Walding](https://discuss.elastic.co/u/Ben_Walding)\
**Post date:** [February 10, 2020, 9:02pm UTC](https://discuss.elastic.co/t/fallback-in-highlight-fields-not-working-as-documented/218669/1 "2020-02-10T21:02:08Z")

</div>

(basically the same issue as reported here - [Highlight fields not matching multiple words - #2 by JasonStoltz](https://discuss.elastic.co/t/highlight-fields-not-matching-multiple-words/211383/2))

When querying using highlight\_fields, for a non-exact match, I would expect that setting fallback=true would cause the search response to include raw data in the highlight field.

(as per docs - [Highlight Fields | Swiftype Documentation](https://swiftype.com/documentation/site-search/searching/highlight-fields))

What we actually see is that the highlight field in the response is empty. The demo shown at [https://search-ui-stable-site-search.netlify.com/?q=100-mile&size=n\_20\_n](https://search-ui-stable-site-search.netlify.com/?q=100-mile&size=n_20_n) is "cheating" - when it receives nothing in the highlight field, it substitutes the body of the search response document.

In the image below we searched for "100 mile" (unquoted) and the highlighter worked properly.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/a/daea074517fdbe2f4eaccf2342c80a438fd8db9e.png)

When we search for "100-mile" (unquoted), the search response does not contain highlight data - and the body content is substituted by the front-end.

Request fragment:

```
curl 'https://search-api.swiftype.com/api/v1/public/engines/search.json' \
  -H 'Accept: */*' \
  -H 'Content-Type: application/json' \
  --data '{"engine_key":"Z43R5U3HiDsDgpKawZkA","per_page":20,"page":1,"facets":{"national-parks":["world_heritage_site","states"]},"fetch_fields":{"national-parks":["visitors","world_heritage_site","location","acres","square_km","title","nps_link","states","date_established","description"]},"highlight_fields":{"national-parks":{"title":{"size":100,"fallback":true},"description":{"size":100,"fallback":true}}},"q":"100-mile"}'

```

![image](https://us1.discourse-cdn.com/elastic/original/3X/0/a/0a0b59f2b9a8ebfea11834a5402a8a2241ff5933.png)

Response fragment:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/3/136fe48a1a8dde783723a60ab31ea39dba6e35d7.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/1/113ec714a09c2de9b19552f4772c65f41023f460.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:** [February 11, 2020, 1:10pm UTC](https://discuss.elastic.co/t/fallback-in-highlight-fields-not-working-as-documented/218669/2 "2020-02-11T13:10:42Z")

</div>

Good catch Ben, I'll put in an issue and see that we get this fixed.

---

<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:** [March 10, 2020, 1:10pm UTC](https://discuss.elastic.co/t/fallback-in-highlight-fields-not-working-as-documented/218669/3 "2020-03-10T13:10:48Z")

</div>

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