# Nest Client not allowing default Boolean Queries

**URL:** <https://discuss.elastic.co/t/nest-client-not-allowing-default-boolean-queries/286871>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [October 15, 2021, 7:45pm UTC](https://discuss.elastic.co/t/nest-client-not-allowing-default-boolean-queries/286871 "2021-10-15T19:45:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmymacGA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimmymacga/32/47144_2.png) [@jimmymacGA](https://discuss.elastic.co/u/jimmymacGA)\
**Post date:** [October 15, 2021, 7:45pm UTC](https://discuss.elastic.co/t/nest-client-not-allowing-default-boolean-queries/286871/1 "2021-10-15T19:45:00Z")

</div>

I am trying to use the Nest client to create a custom class that can be instantiated with a default request. I am using the following code to create a boolean query that will become part of a default SearchRequest object.

```auto

			var bq = new BoolQuery()
			{
				Filter = new QueryContainer[] { },
				Must = new QueryContainer[] { },
				MustNot = new QueryContainer[] { },
				Should = new QueryContainer[] { }
		};

```

The problem is if I return this as is I get a null object. If I add a default query such as a new MatchAll() query then the object comes back as expected.

Is there a workaround or flag to override this ? QueryContainer doesn't seem to have an IsStrict or Verbatim property to set.

---

<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:** [November 12, 2021, 7:45pm UTC](https://discuss.elastic.co/t/nest-client-not-allowing-default-boolean-queries/286871/2 "2021-11-12T19:45:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [November 15, 2021, 8:54am UTC](https://discuss.elastic.co/t/nest-client-not-allowing-default-boolean-queries/286871/3 "2021-11-15T08:54:05Z")

</div>

Hi @jimmymacGA

```auto
var client = new ElasticClient(settings);
	
var bq = new BoolQuery()
{
	IsVerbatim = true,
	Filter = new QueryContainer[] { },
	Must = new QueryContainer[] { },
	MustNot = new QueryContainer[] { },
	Should = new QueryContainer[] { }
};

var searchResponse = client.Search<Data>(s => s
	.Index("data")
	.Query(_ => bq)
);

```

will serialize to

```json
POST /data/_search?pretty=true&typed_keys=true
{
  "query": {
    "bool": {}
  }
}

```

Is that what you'd like to do?
