title: elasticsearch array query containing json data
body: <p>I want to query on complex data nested in arrays in elasticsearch. My data looks like this:</p>
  
  <pre><code>{
      "name": "Alice and Bob",
      "attribs": [
          {
              "attrib-name": "city",
              "attrib-value": "London"
          },
          {
              "attrib-name": "interest",
              "attrib-value": "Shopping"
          }
      ]
  }
  </code></pre>
  
  <p>Now I want to query the data stored in elasticsearch and ask for all documents with: </p>
  
  <pre><code>"attrib-value": "London"
  </code></pre>
  
  <p>Or more advanced for documents with:</p>
  
  <pre><code>"attrib-name": "city"
  "attrib-value": "Hong-Kong"
  </code></pre>
  
  <p>I know that there other ways to store the data, i.e. not using arrays with <code>"attrib-name"</code> and <code>"attrib-value"</code> but in this case it's given and I'm looking for ways on how to query on the existing model.</p>