title: Elastic search query to return documents matching all elements in an array
body: <p>I have a structure similar to this:</p>
  
  <p>Document 1:</p>
  
  <pre><code>nestedobject: {
  uniqueid: "12345",
  field: [ {id: 1,
            color: blue,
           fruit:banana},
  {id: 2,
            color: red,
  fruit:apple},
  ]
  }
  </code></pre>
  
  <p>Document 2: (in same index)</p>
  
  <pre><code>nestedobject: {
  uniqueid:23456,
  field: [ {id: 3,
            color: blue, 
  fruit:banana},
  {id: 4,
            color: blue,
  fruit:banana},
  ]
  }
  </code></pre>
  
  <p><strong>the field mappings can be seen as :</strong></p>
  
  <pre><code>{"mappings":
   "nestedobject":{
  "properties":{
  "uniqueid":{
  "type":"text",
  "fields":{
  "keyword":{
  "type":"keyword",
  "ignore_above":256
  }
  }
  }
  "field":{
  "type":"nested",
  "id":{
  "type":"text",
  "fields":{
  "keyword":{
  "type":"keyword",
  "ignore_above":256
  }
  }
  },
  "color":{
  "type":"text",
  "fields":{
  "keyword":{
  "type":"keyword",
  "ignore_above":256
  }
  }
  },
  "fruit":{
  "type":"text",
  "fields":{
  "keyword":{
  "type":"keyword",
  "ignore_above":256
  }
  }
  }
  }
  }
  }
  }
  </code></pre>
  
  <p>Now, I try to query this index with 2 documents and I want only the document which has all the elements in the field array with color blue and fruit as banana -  NOT ATLEAST 1. </p>
  
  <p>Right now, with the query, I get returned both the documents as it matches with the first element of the first document and returns that.</p>
  
  <p>How to make this possible?</p>
  
  <pre><code>{
      "query": {
          "nested" : {
              "path" : "nestedobject.field",
              "query" : {
                  "bool" : {
                      "must" : [
                      { "match" : {"nestedobject.field.color" : "blue"} },
                      { "match" : {"nestedobject.field.fruit" : "banana"}}
                      ]
                  }
              }
          }
      }
  }
  </code></pre>