# NOT Queries documents returning no highlight fragment

**URL:** <https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016>\
**Category:** Elasticsearch\
**Created:** [June 23, 2022, 1:32pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016 "2022-06-23T13:32:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcmiron](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jcmiron](https://discuss.elastic.co/u/jcmiron)\
**Post date:** [June 23, 2022, 1:32pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016/1 "2022-06-23T13:32:21Z")

</div>

If I do a query like "NOT (CANADA)" or something like that it'll return the documents that don't include that word in it, but not return any highlight fragment.

Is this the default behavior for a query like that?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 23, 2022, 1:34pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016/2 "2022-06-23T13:34:31Z")

</div>

What would you expect to be highlighted given that what you are querying for does not exist in the document?

---

<div class="post-metadata">

**Author:** ![jcmiron](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jcmiron](https://discuss.elastic.co/u/jcmiron)\
**Post date:** [June 23, 2022, 1:36pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016/3 "2022-06-23T13:36:47Z")

</div>

I guess technically the whole field would of been returned I suppose, since the whole document is a match maybe?

I just want to make sure that isn't a bug and I can work with that. If this is the expected behavior I can work with that I just wanted to make sure it wasn't a bug I guess is what I was asking.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 23, 2022, 1:44pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016/4 "2022-06-23T13:44:17Z")

</div>

Highlighting does just highlight what has matched not other parts, so whatvyou are seeing is what i would expect.

---

<div class="post-metadata">

**Author:** ![jcmiron](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jcmiron](https://discuss.elastic.co/u/jcmiron)\
**Post date:** [June 23, 2022, 1:46pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016/5 "2022-06-23T13:46:58Z")

</div>

Yea it makes sense to me now, thanks.

---

<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:** [July 21, 2022, 1:47pm UTC](https://discuss.elastic.co/t/not-queries-documents-returning-no-highlight-fragment/308016/6 "2022-07-21T13:47:31Z")

</div>

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