Filter on outer object as well as Nested object

My data looks like below .
Need to filter on "progName" and "name"

{
"name":"avinash",
"assistance":"yes",
"amount":10000,
"programs":[
{
"progName":"Agriculture",
"BachelorsProgs":53,
"subs":[
{
"progName":"Agricultural Business",
"BachelorsProgs":53
}
]
},
{
"progName":"XYZ",
"BachelorsProgs":12,
"subs":[
{
"progName":"Agricultural Business",
"BachelorsProgs":53
}
]
}
]
}

My Mapping

{
"mappings":{
"university":{
"properties":{
"programs":{
"type":"nested",
"properties":{
"progName":{
"type":"multi_field",
"fields":{
"facet":{
"type":"string",
"index":"not_analyzed"
},
"progName":{
"type":"string"
}
}
}
}
}
}
}
}
}

when i query using below query i get exception

{
"query":{
"filtered":{
"query":{
"match_all":{

        }
     },
     "filter":{
         "bool": {
         "must": [
            {"term": {
               "name": "avinash"
            }}
         ]
         },
        "nested":{
           "path":"programs",
           "filter":{
              "bool":{
                 "must":[
                    {
                       "term":{
                          "programs.progName":"bible"
                       }
                    },
                    {
                       "range":{
                          "programs.BachelorsProgs":{
                             "gt":0
                          }
                       }
                    }
                 ]
              }
           }
        }
     }
  }

}
}

How do we filter on nested object as well as outer object in a single query

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6229cf27-bc30-4a32-9a87-6988bdd8a5bd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.