List Doc search in Doc

Hi,
I have some classes like below. And i want to search, list of the person records that persontype id = 5 and name = "XX"

class Person
{
    public int Id { get; set; }
    public string Firstname { get; set; }
    public string Lastname { get; set; }
    public string User { get; set; }
    public string Pass { get; set; }
    public bool active { get; set; }

    public List<PersonType> listType { get; set; }
}

public class PersonType
{
    public int id { get; set; }
    public string name { get; set; }
}

Without having seen the actual json you indexed: Sounds like you should be able to achieve with a simple combination of a bool and term query to me:

DELETE index
 
PUT index/type/1
{
    "name": "john",
    "types": [1, 2, 3]
}

GET _search
{
    "query": {
        "bool": {
            "must": [
               {"term": {"name": {"value": "john"}}},
               {"term": {"types": "1"}}
        ]
        }}
}

The ES Query DSL docs should provide you with more info. Probably the data modeling docs are also interesting for you.

Translating this to .NET code should be easy enough with https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html