Incorrect response from elasticsearch Node.js client v7.2.0 for aggregation query

Hello,

I am sending a nested aggregation query on a nested object using the Node.js client v7.2.0 for elasticsearch. While executing the query on Node.js client, i am getting all the records for that index and not the filtered result with aggregation. Executing the same query using kibana or curl provides the expected result.

Query :-

{
  "size": 0,
  "query": {
      "bool": {
          "must": [
              {
                  "nested": {
                      "path": "doc.parentKey",
                      "query": {
                          "bool": {
                              "must": [
                                  {
                                      "term": {
                                          "doc.parentKey.name.keyword": "Name1"
                                      }
                                  }
                              ]
                          }
                      }
                  }
              },
              {
                  "term": {
                      "doc.owner.keyword": "0aa7b933-eab1-4939-b4d2-38c2d0602cba"
                  }
              }
          ]
      }
  },
  "aggs": {
      "parentKey": {
          "nested": {
              "path": "doc.parentKey"
          },
          "aggs": {
              "response": {
                  "aggs": {
                      "name": {
                          "terms": {
                              "field": "doc.parentKey.name.keyword"
                          },
                          "aggs": {
                              "value": {
                                  "terms": {
                                      "field": "doc.parentKey.value.keyword"
                                  }
                              }
                          }
                      }
                  },
                  "filter": {
                      "term": {
                          "doc.parentKey.name.keyword": "Name1"
                      }
                  }
              }
          }
      }
  }
}

Expected result (Getting this from kibana and curl)

{
  "took" : 47,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 131,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "parentKey" : {
      "doc_count" : 10218,
      "response" : {
        "doc_count" : 131,
        "name" : {
          "doc_count_error_upper_bound" : 0,
          "sum_other_doc_count" : 0,
          "buckets" : [
            {
              "key" : "Name1",
              "doc_count" : 131,
              "value" : {
                "doc_count_error_upper_bound" : 0,
                "sum_other_doc_count" : 0,
                "buckets" : [
                  {
                    "key" : "Value1",
                    "doc_count" : 131
                  }
                ]
              }
            }
          ]
        }
      }
    }
  }
}

Result from Node.js client https://gist.github.com/kartikchauhan/c89a2776f8f90c20d5e4e6997c13a09b

The response from Node.js client is truncated(the response consisted of 10 objects inside hits.hits array which we would also get by running match_all for this index)

Kindly let me know if any information is required. Any kind of help would be highly appreciated.