如何将特定的 elasticsearch dsl 查询转换为嵌套查询?

how to convert specific elasticsearch dsl query to nest query?

如何将下面的 DSL 查询转换为 C# NEST 查询?

GET project/_search
{
  "size": 0, 
  "aggs": {
  "group_by_projectId": {
      "filter": {
      "terms": {
         "projectId.keyword": ["1", "2", "18"]
       }
    },
    "aggs": {
      "project_tags": {
      "terms": {
        "field": "projectId.keyword",
        "size": 100
     },
      "aggs": {
        "last_process_time": {
          "max": {
            "field": "processedAt"
          }
        }
       }
      }
     }
    }
   }
 }

谁能帮我查询nest?提前谢谢你。

我已经按如下方式转换了查询并且它工作得很好:

_elasticClient.SearchAsync<Project>(s => s
                .Size(0)
                .Aggregations(a => a
                    .Filter("filter_by_projectId", f => f
                        .Filter(ff => ff
                            .Terms(t => t
                                .Field(tf => tf.ProjectId)
                                .Terms(projects
                                    .Select(ps => ps.Id))))
                        .Aggregations(agg => agg
                            .Terms("group_by_projectId", st => st
                                .Field(o => o.ProjectId.Suffix("keyword"))
                                .Size(100)
                                .Aggregations(aa => aa
                                    .Max("last_process_time", sa => sa
                                        .Field(o => o.ProcessedAt))))))));