Elasticsearch NEST (C# Client)

Hello, I want to translate this Filter Agregation to C# (using NEST client) but I don't know how to:

"aggs": {
"Condiciones": {
"filter": {
"bool": {
"filter": [
{ "terms":{ "genre": [ "M", "F", "I", "X" ] } },
{ "terms":{ "alive": [ "false" ] } }
]
}
},
continues...
}

Can somebody help me out? ty!!

You can try something like this:

var a = new FilterAggregation("Condiciones")
{
   Filter = BoolQuery
   {
      Filter=  new List<QueryContainer>
      {
            new TermsQuery
            {
                Field = "genre",
                Terms = new List<string> { "M", "F", "I", "X" }
            }, 
            new TermsQuery
            {
                Field = "alive",
                Terms = new List<string> { "false" }
            }
      },
      // continue...
}
1 Like

My bad, meant to get a solution with FLUENT DSL..

anyways I already found it!! ty for ur answer!

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