'Elastic Search Nested Aggregation with filters from fields which are not nested

I want to filter nested aggregation using non nested fields

Ex: I have structure like {"field1","field2","field3":[{"x","y"},{"x","y"}]} i want to aggregate nested field x based on the filter from field2 is this kind of filter possible in nested aggregation

{
"aggs"{
  "someagg":{
    "nested":{
       "path": "field3",
     },
     "aggregations":{
        "filteragg"{
            "filter": {
                 "terms": {
                     "field1": ["a","b","c"],
                 }
             }
             "aggs"{
                 "newagg":{
                     "sum":{
                         "field": "field3.x",
                       }
                  }
              }
         }
     }
     

   }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source