elasticsearch nested aggregation in csharp

Code Example - elasticsearch nested aggregation in csharp

                
                        var aggs = new AggregationDictionary()
{
    {
        "countries_step1",
        new NestedAggregation("countries_step1")
        {
            Path = "country",
            Aggregations = new AggregationDictionary()
            {
                {
                    "countries_step2",
                    new FilterAggregation("countries_step2")
                    {
                        Filter = new BoolQuery
                        {
                            Must = new QueryContainer[]
                            {
                                new TermQuery
                                {
                                    Field = "country.isDisplayed",
                                    Value = true
                                }
                            }
                        },
                        Aggregations = new AggregationDictionary
                        {
                            {
                                "countries_step3",
                                new TermsAggregation("countries_step3")
                                {
                                    Field = "country.displayName.keyword",
                                    Size = 9999
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};