I have stored below type of nested data on my index test\_agg in ES. 

```
{
  "Date": "2015-10-21",
  "Domain": "abc.com",
  "Processed_at": "10/23/2015 9:47",
  "Events": [
    {
      "Name": "visit",
      "Count": "188",
      "Value_Aggregations": [
        {
          "Value": "red",
          "Count": "100"
        }
      ]
    },
    {
      "Name": "order_created",
      "Count": "159",
      "Value_Aggregations": [
        {
          "Value": "$125",
          "Count": "50"
        }
      ]
   },
 ]
}

```

mapping of the nested item is

```
curl -XPOST localhost:9200/test_agg/nested_evt/_mapping -d '{
"nested_evt":{
"properties":{
   "Events": {
       "type": "nested"
    }
   }
  }
}'

```

I am trying to get "Events.Count" and "Events.Value\_Aggregations.Count" where Events.Name='Visit' using the below query

```
{
 "fields" : ["Events.Count","Events.Value_Aggregations.Count"]
  "query": {
     "filtered": {
        "query": {
            "match": { "Domain": "abc.com" }
        },
        "filter": {
            "nested": {
                "path": "Events",
                "query": {
                     "match": { "Events.Name": "visit" }
                },
              }
          }
      }
   }
 }

```

instead of resulting single value 

> 
> Events.Count=[188] Events.Value\_Aggregations.Count=[100]
> 
> 
> 

it gives

> 
> Events.Count=[188,159] Events.Value\_Aggregations.Count=[100,50]
> 
> 
> 

what is the exact query structure to get my desired output?