title: Elasticsearch filtering nested object
body: <p>I have a simplified object that looks something like this:</p>
  
  <pre><code>"name" : "Partner Name",
  "features" : [ 
      {
          "val" : "Family",
          "key" : "Type"
      },
      {
          "val" : "Paris",
          "key" : "City"
      }
  ],
  "variants" : [ 
      {
          "name" : "Activity 1 Name",
          "description" : "Quick description",
          "price" : 20
      }
  ]
  </code></pre>
  
  <p>I want to filter by the City and Type keys. My current query filters by price but I can't get it working for City or Type. Adding more terms to the filter array didn't do the trick.</p>
  
  <pre><code>'query':{
      'filtered':{
          'query':{
              'query_string':{
                  'query':query
              }
          },
      'filter': {
          'bool':{
              'filter': [{ 
                      'range': {
                          'variants.price': {
                              'gte': 0
                          }
                      }
                  },
                  { 
                      'range': {
                          'variants.price': {
                              'lte': 50
                          }
                      }
                  },
                  {
                      'term': {
                          'active': true
                      }
                  }
              ]
          }
       }
    }
  }
  </code></pre>
  
  <p>Any help would be appreciated. Thanks!</p>