# Error when searching via a boolean field

**URL:** <https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465>\
**Category:** Developing with Prismic\
**Tags:** rest-api\
**Created:** [March 22, 2022, 2:56pm UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465 "2022-03-22T14:56:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigo.ramos](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@rodrigo.ramos](https://community.prismic.io/u/rodrigo.ramos)\
**Post date:** [March 22, 2022, 2:56pm UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465/1 "2022-03-22T14:56:52Z")

</div>

When I try to search via a boolean field, if at least one document isn't toggled to true I get the following error. It should return an empty array instead of returning error.

 ![Screenshot from 2022-03-21 18-20-44](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/7/719a766729e3d20e22276af1219b6009a05b3578.png)

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [March 22, 2022, 6:16pm UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465/3 "2022-03-22T18:16:14Z")

</div>

Hi @rodrigo.ramos,

I will try to reproduce this issue and investigated it

It would be useful if you can share with us your repository name (in a private message if necessary) as well as a link to that query

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [March 24, 2022, 11:46am UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465/4 "2022-03-24T11:46:40Z")

</div>

I have done some tests, and I've been able to reproduce the issue,

And so the current behavior is that when you create a new field with a default value after creating the document, the default value doesn't work and stays null.

This is certainly a bug, and the expected behavior is that you have to unpublish and publish the documents for the default values to be assigned. Currently, that doesn't happen as you need to set the value manually document by document.

Another bug here is that when `[at(my.lesson.featured, true)]` should not throw an error and instead return nothing if the no changes (new version) of the document has been done (a null value shouldn't exist in my opinion) or the API should ignore the unassigned fields if they are not published.

So for that, I will create an issue in our tracker, and I will let you know in case of any updates.

---

<div class="post-metadata">

**Author:** ![rodrigo.ramos](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@rodrigo.ramos](https://community.prismic.io/u/rodrigo.ramos)\
**Post date:** [March 24, 2022, 5:59pm UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465/7 "2022-03-24T17:59:37Z")

</div>

Thanks for the heads-up!

We've added a workaround on our side that if we're searching with this query and it returns an error it actually means there is no content but we hope to change this in the future if you implement a fix for this issue 👋

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [March 28, 2022, 4:43pm UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465/8 "2022-03-28T16:43:27Z")

</div>

Thanks for sharing this workaround.

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [May 10, 2022, 9:10am UTC](https://community.prismic.io/t/error-when-searching-via-a-boolean-field/9465/10 "2022-05-10T09:10:48Z")

</div>

Hi @rodrigo.ramos,

A quick update on this issue, our dev team, confirms it's an editor issue, and we will be taken care of in an ongoing redo of the editor.
