# Nest Client - Searching nested properties

**URL:** <https://discuss.elastic.co/t/nest-client-searching-nested-properties/177345>\
**Category:** Elasticsearch\
**Created:** [April 17, 2019, 4:38pm UTC](https://discuss.elastic.co/t/nest-client-searching-nested-properties/177345 "2019-04-17T16:38:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bo.clifton](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@bo.clifton](https://discuss.elastic.co/u/bo.clifton)\
**Post date:** [April 17, 2019, 4:38pm UTC](https://discuss.elastic.co/t/nest-client-searching-nested-properties/177345/1 "2019-04-17T16:38:44Z")

</div>

I'm having a tough time finding information on how to search nested properties using the Nest client in C#.

I have email objects in an index with approximately this shape:  
{

```
  subject: “This is a test”,
  content: “This is an email written as a test of the Elasticsearch system. Thanks, Mr Tom Jones”,
  custodians: [
    {
      firstName: “Tom”,
      lastName: “Jones”,
      routeType: 0
    },
    {
      firstName: “Matthew”,
      lastName: “Billsley”,
      routeType: 1
    }
  ]
}

```

You should be able to see that there is an array in there called “custodians” which is a list of all the senders and recipients of the email. In the Fluent-style query builder in .Net I can build the query just fine when I’m using subject, content, and other “first tier” properties. But I may only want to include custodians who have the routeType = 0 in some queries. I can’t seem to find any guidance on how to accomplish this. Any ideas?

For instance, a query for the term “picnic” in the subject field would look like:

```
Client.SearchAsync(m => m
  .Query(q => q
    .Match(f => f
      .Field(msg => msg.Subject)
      .Query(“picnic”))));

```

What would the query to only get messages from the index with routeType = 0 and lastName = “Jones” be?

---

<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:** [May 15, 2019, 4:38pm UTC](https://discuss.elastic.co/t/nest-client-searching-nested-properties/177345/2 "2019-05-15T16:38:57Z")

</div>

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