---
title: Boolean
slug: cms-12/docs/boolean
docTags: 
createdAt: 2026-08-10T15:56:00.000Z
---

Use filters to narrow down search results or for database-like queries.

You can use the `Filter` method to filter Boolean and nullable *Boolean* fields in a couple of ways, as shown in the following use cases and examples.

## Exists

To search for documents where a Boolean field has a value, use the `Exists` method. The following search finds blog posts with an `Approved` property with a value. The following code is similar to the LINQ query `Where(x => x.Approved.HasValue)`.

```csharp
var searchQuery = client.Search<BlogPost>()
    .Filter(x => x.Approved.Exists());
```

You can negate the filter with an exclamation point (!). To find blog posts that lack an `Approved` property, use the following code.

```csharp
var searchQuery = client.Search<BlogPost>()
    .Filter(x => !x.Approved.Exists());
```

## True or false

For exact matching, use the `Match` method. The following search matches blog posts whose `Approved` property is true. The LINQ equivalent is `Where(x => x.Approved)`.

```csharp
var searchQuery = client.Search<BlogPost>()
    .Filter(x => x.Approved.Match(true));
```
